decl.c (grokdeclarator): Set context of namespace scope TYPE_DECLS.
cp: * decl.c (grokdeclarator): Set context of namespace scope TYPE_DECLS. testsuite: * g++.old-deja/g++.ns/type2.C: New test. From-SVN: r41533
This commit is contained in:
parent
12da8316cc
commit
6bda7a5e41
4 changed files with 34 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* decl.c (grokdeclarator): Set context of namespace scope
|
||||
TYPE_DECLS.
|
||||
|
||||
2001-04-24 Zack Weinberg <zackw@stanford.edu>
|
||||
|
||||
* cp/optimize.c: Include hashtab.h.
|
||||
|
|
|
@ -11035,8 +11035,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
|||
decl = build_lang_decl (TYPE_DECL, declarator, type);
|
||||
}
|
||||
else
|
||||
decl = build_decl (TYPE_DECL, declarator, type);
|
||||
|
||||
{
|
||||
decl = build_decl (TYPE_DECL, declarator, type);
|
||||
if (!current_function_decl)
|
||||
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
|
||||
}
|
||||
|
||||
/* If the user declares "typedef struct {...} foo" then the
|
||||
struct will have an anonymous name. Fill that name in now.
|
||||
Nothing can refer to it, so nothing needs know about the name
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.ns/type2.C: New test.
|
||||
|
||||
2001-04-24 Zack Weinberg <zackw@stanford.edu>
|
||||
|
||||
* g++.old-deja/g++.other/perf1.C: New test.
|
||||
|
|
19
gcc/testsuite/g++.old-deja/g++.ns/type2.C
Normal file
19
gcc/testsuite/g++.old-deja/g++.ns/type2.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Build don't link:
|
||||
//
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 11 April 2001 <nathan@codesourcery.com>
|
||||
// Origin:stephen.webb@cybersafe.com
|
||||
|
||||
// Bug 2125. TYPE_DECLS never had their DECL_CONTEXT set, which
|
||||
// confused forward references to classes.
|
||||
|
||||
typedef void T;
|
||||
namespace A {
|
||||
class C;
|
||||
typedef class C C;
|
||||
typedef int T;
|
||||
class C
|
||||
{
|
||||
T i; // got bogus error, found wrong T
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue