re PR c++/2914 (gcc 3.0 crashes on xalan DoubleSupport.cpp)

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
This commit is contained in:
Nathan Sidwell 2001-06-07 16:15:45 +00:00 committed by Nathan Sidwell
parent d7e5d7feae
commit fcebb2ddda
4 changed files with 52 additions and 1 deletions

View 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.

View 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);

View 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.

View File

@ -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()
{
}