Commit 6bda7a5e by Nathan Sidwell Committed by Nathan Sidwell

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
parent 12da8316
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> 2001-04-24 Zack Weinberg <zackw@stanford.edu>
* cp/optimize.c: Include hashtab.h. * cp/optimize.c: Include hashtab.h.
......
...@@ -11035,8 +11035,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -11035,8 +11035,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
decl = build_lang_decl (TYPE_DECL, declarator, type); decl = build_lang_decl (TYPE_DECL, declarator, type);
} }
else 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 /* If the user declares "typedef struct {...} foo" then the
struct will have an anonymous name. Fill that name in now. struct will have an anonymous name. Fill that name in now.
Nothing can refer to it, so nothing needs know about the name Nothing can refer to it, so nothing needs know about the name
......
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> 2001-04-24 Zack Weinberg <zackw@stanford.edu>
* g++.old-deja/g++.other/perf1.C: New test. * g++.old-deja/g++.other/perf1.C: New test.
......
// 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
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment