Commit 2427db20 by Paolo Carlini Committed by Paolo Carlini

re PR c++/31489 (error says struct when it should say class)

/cp
2011-09-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/31489
	* parser.c (cp_parser_elaborated_type_specifier): For RECORD_TYPE,
	set CLASSTYPE_DECLARED_CLASS.

/testsuite
2011-09-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/31489
	* g++.dg/parse/error40.C: New.
	* g++.dg/warn/incomplete1.C: Adjust.

From-SVN: r179293
parent 82aa8722
2011-09-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/31489
* parser.c (cp_parser_elaborated_type_specifier): For RECORD_TYPE,
set CLASSTYPE_DECLARED_CLASS.
2011-09-27 Jakub Jelinek <jakub@redhat.com>
* decl.c (duplicate_decls): If compatible stpcpy prototype
......
......@@ -13423,7 +13423,13 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
}
if (tag_type != enum_type)
cp_parser_check_class_key (tag_type, type);
{
/* Indicate whether this class was declared as a `class' or as a
`struct'. */
if (TREE_CODE (type) == RECORD_TYPE)
CLASSTYPE_DECLARED_CLASS (type) = (tag_type == class_type);
cp_parser_check_class_key (tag_type, type);
}
/* A "<" cannot follow an elaborated type specifier. If that
happens, the user was probably trying to form a template-id. */
......
2011-09-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/31489
* g++.dg/parse/error40.C: New.
* g++.dg/warn/incomplete1.C: Adjust.
2011-09-27 Jan Hubicka <jh@suse.cz>
PR middle-end/49463
......
// PR c++/31489
class foo; // { dg-error "'class foo'" }
struct bar; // { dg-error "'struct bar'" }
int main()
{
foo* f = new foo; // { dg-error "'class foo'" }
bar* b = new bar; // { dg-error "'struct bar'" }
}
......@@ -9,7 +9,7 @@
// (But the deletion does not constitute an ill-formed program. So the
// program should nevertheless compile, but it should give a warning.)
class A; // { dg-warning "forward declaration of 'struct A'" "" }
class A; // { dg-warning "forward declaration of 'class A'" "" }
A *a; // { dg-warning "'a' has incomplete type" "" }
......
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