* decl.c (declare_global_var): Use the return value from pushdecl.
PR c++/14667
* parser.c (cp_parser_simple_declaration): Do not diagnose invalid
type names if we have already found a valid type.
(cp_parser_member_declaration): Likewise.
PR c++/17852
* parser.c (cp_parser_member_specification_opt): Handle
CPP_PRAGMA.
PR c++/17042
* g++.dg/init/dso_handle1.C: New test.
PR c++/17852
* g++.dg/parse/pragma1.C: New test.
PR c++/14667
* g++.dg/parse/typedef6.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89118
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-10-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/17042
+ * decl.c (declare_global_var): Use the return value from pushdecl.
+
+ PR c++/14667
+ * parser.c (cp_parser_simple_declaration): Do not diagnose invalid
+ type names if we have already found a valid type.
+ (cp_parser_member_declaration): Likewise.
+
+ PR c++/17852
+ * parser.c (cp_parser_member_specification_opt): Handle
+ CPP_PRAGMA.
+
2004-10-15 Kazu Hirata <kazu@cs.umass.edu>
* dump.c, g++spec.c, repo.c: Update copyright.
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
- pushdecl (decl);
+ /* If the user has explicitly declared this variable (perhaps
+ because the code we are compiling is part of a low-level runtime
+ library), then it is possible that our declaration will be merged
+ with theirs by pushdecl. */
+ decl = pushdecl (decl);
cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0);
pop_from_top_level ();
T t;
where "T" should name a type -- but does not. */
- if (cp_parser_parse_and_diagnose_invalid_type_name (parser))
+ if (!decl_specifiers.type
+ && cp_parser_parse_and_diagnose_invalid_type_name (parser))
{
/* If parsing tentatively, we should commit; we really are
looking at a declaration. */
break;
default:
+ /* Accept #pragmas at class scope. */
+ if (token->type == CPP_PRAGMA)
+ {
+ cp_lexer_handle_pragma (parser->lexer);
+ break;
+ }
+
/* Otherwise, the next construction must be a
member-declaration. */
cp_parser_member_declaration (parser);
prefix_attributes = decl_specifiers.attributes;
decl_specifiers.attributes = NULL_TREE;
/* Check for an invalid type-name. */
- if (cp_parser_parse_and_diagnose_invalid_type_name (parser))
+ if (!decl_specifiers.type
+ && cp_parser_parse_and_diagnose_invalid_type_name (parser))
return;
/* If there is no declarator, then the decl-specifier-seq should
specify a type. */
+2004-10-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/17042
+ * g++.dg/init/dso_handle1.C: New test.
+
+ PR c++/17852
+ * g++.dg/parse/pragma1.C: New test.
+
+ PR c++/14667
+ * g++.dg/parse/typedef6.C: New test.
+
2004-10-15 Aldy Hernandez <aldyh@redhat.com>
* gcc.c-torture/execute/ieee/ieee.exp: Disable on powerpc-*-*spe.
--- /dev/null
+// PR c++/17042
+// { dg-do assemble }
+// { dg-options "-fuse-cxa-atexit" }
+
+struct A
+{ A(); ~A(); };
+A a;
+extern "C" { void* __dso_handle __attribute__ ((__weak__)); }
+void f()
+{ __dso_handle = 0; }
--- /dev/null
+// PR c++/17852
+
+class T {
+#pragma X
+ struct S {
+ };
+#pragma Y
+};
--- /dev/null
+// PR c++/14667
+
+template<class T>
+class Class1;
+
+class Class2 {} typedef Class1<Class2> Type1; // { dg-error "" }