35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
2007-11-26 Jakub Jelinek <jakub@redhat.com>
|
|
|
|
PR c++/34238
|
|
* decl2.c (cp_write_global_declarations): Test
|
|
!DECL_INITIALIZED_IN_CLASS_P instead of checking NULL
|
|
DECL_INITIAL.
|
|
|
|
* g++.dg/ext/visibility/anon9.C: New test.
|
|
|
|
--- gcc/cp/decl2.c.jj 2007-11-22 15:03:54.000000000 +0100
|
|
+++ gcc/cp/decl2.c 2007-11-26 21:04:38.000000000 +0100
|
|
@@ -3375,7 +3375,7 @@ cp_write_global_declarations (void)
|
|
namespace { struct A { static const int i = 4; } };
|
|
decl_needed_p won't reliably detect whether it was
|
|
really needed. */
|
|
- if (DECL_IN_AGGR_P (decl) && DECL_INITIAL (decl) == NULL_TREE)
|
|
+ if (DECL_IN_AGGR_P (decl) && !DECL_INITIALIZED_IN_CLASS_P (decl))
|
|
error ("%Jstatic data member %qD used, but not defined",
|
|
decl, decl);
|
|
DECL_EXTERNAL (decl) = 0;
|
|
--- gcc/testsuite/g++.dg/ext/visibility/anon9.C.jj 2007-11-26 21:37:34.000000000 +0100
|
|
+++ gcc/testsuite/g++.dg/ext/visibility/anon9.C 2007-11-26 21:38:01.000000000 +0100
|
|
@@ -0,0 +1,11 @@
|
|
+// PR c++/34238
|
|
+// { dg-do compile }
|
|
+
|
|
+namespace
|
|
+{
|
|
+ template <typename T = int> struct A
|
|
+ {
|
|
+ static const bool a = true;
|
|
+ };
|
|
+}
|
|
+struct A<> a;
|