|
|
7a6771 |
http://sourceware.org/ml/gdb-patches/2016-09/msg00083.html
|
|
|
7a6771 |
Subject: [testsuite patch] Fix C++11 compilation failure for gdb.cp/m-static.exp
|
|
|
7a6771 |
|
|
|
7a6771 |
|
|
|
7a6771 |
--y0ulUmNC+osPPQO6
|
|
|
7a6771 |
Content-Type: text/plain; charset=iso-2022-jp
|
|
|
7a6771 |
Content-Disposition: inline
|
|
|
7a6771 |
|
|
|
7a6771 |
Hi,
|
|
|
7a6771 |
|
|
|
7a6771 |
gcc-6.2.1-1.fc26.x86_64
|
|
|
7a6771 |
|
|
|
7a6771 |
g++ -std=c++03:
|
|
|
7a6771 |
no warnings
|
|
|
7a6771 |
|
|
|
7a6771 |
g++:
|
|
|
7a6771 |
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:0:
|
|
|
7a6771 |
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:34: error: ‘constexpr’ needed for in-class initialization of static data member ‘const float gnu_obj_4::somewhere’ of non-integral type [-fpermissive]
|
|
|
7a6771 |
static const float somewhere = 3.14159;
|
|
|
7a6771 |
^~~~~~~
|
|
|
7a6771 |
|
|
|
7a6771 |
clang++:
|
|
|
7a6771 |
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
|
|
|
7a6771 |
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: warning: in-class initializer for static data member of type 'const float' is a GNU extension [-Wgnu-static-float-init]
|
|
|
7a6771 |
static const float somewhere = 3.14159;
|
|
|
7a6771 |
^ ~~~~~~~
|
|
|
7a6771 |
1 warning generated.
|
|
|
7a6771 |
|
|
|
7a6771 |
clang++ -std=c++11:
|
|
|
7a6771 |
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
|
|
|
7a6771 |
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: error: in-class initializer for static data member of type 'const float' requires 'constexpr' specifier [-Wstatic-float-init]
|
|
|
7a6771 |
static const float somewhere = 3.14159;
|
|
|
7a6771 |
^ ~~~~~~~
|
|
|
7a6771 |
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:3: note: add 'constexpr'
|
|
|
7a6771 |
static const float somewhere = 3.14159;
|
|
|
7a6771 |
^
|
|
|
7a6771 |
constexpr
|
|
|
7a6771 |
1 error generated.
|
|
|
7a6771 |
|
|
|
7a6771 |
OK for check-in?
|
|
|
7a6771 |
|
|
|
7a6771 |
After the fix out of the 4 combinations above only this one remains non-empty:
|
|
|
7a6771 |
|
|
|
7a6771 |
clang++:
|
|
|
7a6771 |
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
|
|
|
7a6771 |
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: warning: in-class initializer for static data member of type 'const float' is a GNU extension [-Wgnu-static-float-init]
|
|
|
7a6771 |
static const float somewhere = 3.14159;
|
|
|
7a6771 |
^ ~~~~~~~
|
|
|
7a6771 |
1 warning generated.
|
|
|
7a6771 |
|
|
|
7a6771 |
|
|
|
7a6771 |
Jan
|
|
|
7a6771 |
|
|
|
7a6771 |
--y0ulUmNC+osPPQO6
|
|
|
7a6771 |
Content-Type: text/plain; charset=us-ascii
|
|
|
7a6771 |
Content-Disposition: inline; filename=1
|
|
|
7a6771 |
|
|
|
7a6771 |
gdb/testsuite/ChangeLog
|
|
|
7a6771 |
2016-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
7a6771 |
|
|
|
7a6771 |
* gdb.cp/m-static.h (gnu_obj_4::somewhere): Use constexpr for C++11.
|
|
|
7a6771 |
|
|
|
7a6771 |
diff --git a/gdb/testsuite/gdb.cp/m-static.h b/gdb/testsuite/gdb.cp/m-static.h
|
|
|
7a6771 |
index bcedfff..2992463 100644
|
|
|
7a6771 |
--- a/gdb/testsuite/gdb.cp/m-static.h
|
|
|
7a6771 |
+++ b/gdb/testsuite/gdb.cp/m-static.h
|
|
|
7a6771 |
@@ -6,6 +6,9 @@ class gnu_obj_4
|
|
|
7a6771 |
static const int elsewhere;
|
|
|
7a6771 |
static const int nowhere;
|
|
|
7a6771 |
static const int everywhere = 317;
|
|
|
7a6771 |
+#if __cplusplus >= 201103L
|
|
|
7a6771 |
+ constexpr
|
|
|
7a6771 |
+#endif
|
|
|
7a6771 |
static const float somewhere = 3.14159;
|
|
|
7a6771 |
|
|
|
7a6771 |
// try to ensure test4 is actually allocated
|
|
|
7a6771 |
|
|
|
7a6771 |
--y0ulUmNC+osPPQO6--
|
|
|
7a6771 |
|