* decl2.c (cp_write_global_declarations): Revert 2007-11-22 change.
* g++.dg/ext/visibility/anon7.C: Add xfail.
* g++.dg/ext/visibility/anon9.C: New test.
* g++.dg/ext/visibility/anon10.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130771
138bc75d-0d04-0410-961f-
82ee72b054a4
2007-12-11 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34238
+ * decl2.c (cp_write_global_declarations): Revert 2007-11-22 change.
+
PR c++/34364
* rtti.c (build_dynamic_cast): Call convert_from_reference even for
dynamic_cast in a template.
/* If this static data member is needed, provide it to the
back end. */
if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
- {
- /* Error on
- namespace { struct A { static int i; }; }
- int foo () { return A::i; }
- without A::i definition (which can't be defined in
- a different CU because of the anonymous namespace).
- Don't do this if DECL_INITIAL is set, because for
- 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)
- error ("%Jstatic data member %qD used, but not defined",
- decl, decl);
- DECL_EXTERNAL (decl) = 0;
- }
+ DECL_EXTERNAL (decl) = 0;
}
if (VEC_length (tree, pending_statics) != 0
&& wrapup_global_declarations (VEC_address (tree, pending_statics),
2007-12-11 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34238
+ * g++.dg/ext/visibility/anon7.C: Add xfail.
+ * g++.dg/ext/visibility/anon9.C: New test.
+ * g++.dg/ext/visibility/anon10.C: New test.
+
PR c++/34364
* g++.dg/rtti/dyncast2.C: New test.
--- /dev/null
+// http://bugzilla.redhat.com/411871
+// { dg-do compile }
+
+extern "C" int printf (const char *, ...);
+
+struct E
+{
+ template <typename T> E (const volatile T&);
+ template <typename T> E (T&);
+ char x[64];
+};
+
+template<typename T> struct D
+{
+ static E foo (E, ...);
+ static int foo (T, int);
+};
+
+template<typename T, typename U> struct C
+{
+ static T ca;
+ static const int value = sizeof (D<U>::foo (ca, 0)) == sizeof (int);
+};
+
+struct A
+{
+ int a;
+};
+
+namespace
+{
+ struct B
+ {
+ int a;
+ };
+}
+
+int bar (void)
+{
+ C<A, int> a;
+ C<B, int> b;
+
+ return a.value + b.value;
+}
{
struct A {
static int bar ();
- static int i; // { dg-error "used, but not defined" }
+ static int i; // { dg-error "used, but not defined" "" { xfail *-*-* } }
static int j;
static int k;
static int l;
--- /dev/null
+// PR c++/34238
+// { dg-do compile }
+
+namespace
+{
+ template <typename T = int> struct A
+ {
+ static const bool a = true;
+ };
+}
+struct A<> a;