Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [testsuite patch] Fix C++11 compilation failure for gdb.cp/m-static.exp
@ 2016-09-11 14:22 Jan Kratochvil
  2016-09-15 12:22 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2016-09-11 14:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

Hi,

gcc-6.2.1-1.fc26.x86_64

g++ -std=c++03:
no warnings

g++:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:0:
/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]
   static const float somewhere = 3.14159;
                                  ^~~~~~~

clang++:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
/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]
  static const float somewhere = 3.14159;
                     ^           ~~~~~~~
1 warning generated.

clang++ -std=c++11:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
/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]
  static const float somewhere = 3.14159;
                     ^           ~~~~~~~
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:3: note: add 'constexpr'
  static const float somewhere = 3.14159;
  ^
  constexpr
1 error generated.

OK for check-in?

After the fix out of the 4 combinations above only this one remains non-empty:

clang++:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
/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]
  static const float somewhere = 3.14159;
                     ^           ~~~~~~~
1 warning generated.


Jan

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 609 bytes --]

gdb/testsuite/ChangeLog
2016-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.cp/m-static.h (gnu_obj_4::somewhere): Use constexpr for C++11.

diff --git a/gdb/testsuite/gdb.cp/m-static.h b/gdb/testsuite/gdb.cp/m-static.h
index bcedfff..2992463 100644
--- a/gdb/testsuite/gdb.cp/m-static.h
+++ b/gdb/testsuite/gdb.cp/m-static.h
@@ -6,6 +6,9 @@ class gnu_obj_4
   static const int elsewhere;
   static const int nowhere;
   static const int everywhere = 317;
+#if __cplusplus >= 201103L
+  constexpr
+#endif
   static const float somewhere = 3.14159;
 
   // try to ensure test4 is actually allocated

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-15 21:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-11 14:22 [testsuite patch] Fix C++11 compilation failure for gdb.cp/m-static.exp Jan Kratochvil
2016-09-15 12:22 ` Pedro Alves
2016-09-15 12:34   ` Jan Kratochvil
2016-09-15 13:11     ` Pedro Alves
2016-09-15 21:47       ` [commit] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox