PR c++/51427 - Better diagnostic when union/struct tags conflicts
gcc/cp/ PR c++/51427 * parser.c (cp_parser_check_class_key): Add note about earlier declaration. gcc/testsuite/ PR c++/51427 * g++.dg/diagnostic/wrong-tag-1.C From-SVN: r182043
This commit is contained in:
parent
aa383ddaea
commit
230f834641
@ -1,3 +1,9 @@
|
||||
2011-12-06 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/51427
|
||||
* parser.c (cp_parser_check_class_key): Add note about earlier
|
||||
declaration.
|
||||
|
||||
2011-12-05 Fabien Chêne <fabien@gcc.gnu.org>
|
||||
|
||||
PR c++/51319
|
||||
|
@ -22544,10 +22544,14 @@ static void
|
||||
cp_parser_check_class_key (enum tag_types class_key, tree type)
|
||||
{
|
||||
if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
|
||||
permerror (input_location, "%qs tag used in naming %q#T",
|
||||
class_key == union_type ? "union"
|
||||
: class_key == record_type ? "struct" : "class",
|
||||
type);
|
||||
{
|
||||
permerror (input_location, "%qs tag used in naming %q#T",
|
||||
class_key == union_type ? "union"
|
||||
: class_key == record_type ? "struct" : "class",
|
||||
type);
|
||||
inform (DECL_SOURCE_LOCATION (TYPE_NAME (type)),
|
||||
"%q#T was previously declared here", type);
|
||||
}
|
||||
}
|
||||
|
||||
/* Issue an error message if DECL is redeclared with different
|
||||
|
@ -1,3 +1,8 @@
|
||||
2011-12-06 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/51427
|
||||
* g++.dg/diagnostic/wrong-tag-1.C
|
||||
|
||||
2011-12-05 Fabien Chêne <fabien@gcc.gnu.org>
|
||||
|
||||
PR c++/51319
|
||||
|
4
gcc/testsuite/g++.dg/diagnostic/wrong-tag-1.C
Normal file
4
gcc/testsuite/g++.dg/diagnostic/wrong-tag-1.C
Normal file
@ -0,0 +1,4 @@
|
||||
// Origin PR c++/51427
|
||||
|
||||
typedef struct _GMutex GMutex; // { dg-message "previously declared here"}
|
||||
typedef union _GMutex GMutex; // { dg-error "tag used in naming" }
|
Loading…
Reference in New Issue
Block a user