]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/2914 (gcc 3.0 crashes on xalan DoubleSupport.cpp)
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 7 Jun 2001 16:15:45 +0000 (16:15 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 7 Jun 2001 16:15:45 +0000 (16:15 +0000)
cp:
PR c++/2914
* decl.c (pushtag): Don't push into a complete type's scope.
testsuite:
* g++.old-deja/g++.ext/anon3.C: New test.

From-SVN: r42962

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.ext/anon3.C [new file with mode: 0644]

index 8ba7f9f19668816a7dededfabcd3066d0a1989c3..39ff3399c089c432fa878ceb9576fd4b019e0821 100644 (file)
@@ -1,3 +1,8 @@
+2001-06-07  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/2914
+       * decl.c (pushtag): Don't push into a complete type's scope.
+
 2001-06-06  Jason Merrill  <jason_merrill@redhat.com>
 
        * cp-tree.h (THUNK_GENERATE_WITH_VTABLE_P): Lose.
index ed5686c501f486656561f25dc63f5be944134e6f..22fb9ef7974fb9ac68c1b26c45dfb61da9b80983 100644 (file)
@@ -2812,7 +2812,13 @@ pushtag (name, type, globalize)
 
   b = current_binding_level;
   while (b->tag_transparent
-        || (globalize && b->parm_flag == 2))
+        || (b->parm_flag == 2
+            && (globalize
+                /* We may be defining a new type in the initializer
+                   of a static member variable. We allow this when
+                   not pedantic, and it is particularly useful for
+                   type punning via an anonymous union. */
+                || COMPLETE_TYPE_P (b->this_class))))
     b = b->level_chain;
 
   b->tags = tree_cons (name, type, b->tags);
index 0732fb38b072990c565f7e660196aee95d7488c3..4a77568302456f5b747b9d37e09414943742d14d 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-07  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.ext/anon3.C: New test.
+
 2001-06-05  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.other/conv7.C: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/anon3.C b/gcc/testsuite/g++.old-deja/g++.ext/anon3.C
new file mode 100644 (file)
index 0000000..f4b9903
--- /dev/null
@@ -0,0 +1,36 @@
+// Build don't link:
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Jun 2001 <nathan@codesourcery.com>
+
+// Bug 2914. New types can be created in a static member
+// initializer. These should not be injected into the member's class's
+// scope.
+
+class DoubleSupport
+{
+  public:
+  static void toDouble();
+  
+  static const double s_NaN;
+  static const double s_positiveInfinity;
+  static const double s_negativeInfinity;
+  static const double s_positiveZero;
+  static const double s_negativeZero;
+  static const unsigned long* s_NaNFirstDWORD;
+  static const unsigned long* s_NaNSecondDWORD;
+};
+
+const double DoubleSupport::s_positiveInfinity =
+(__extension__ ((union { unsigned char __c[8]; double __d; })
+  { __c: { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }).__d);
+
+struct other 
+{
+};
+
+
+void
+DoubleSupport::toDouble()
+{
+}
This page took 0.123968 seconds and 5 git commands to generate.