re PR c++/16193 (Bootstrap failure in libstdc++-v3)

PR c++/16193
	* parser.c (cp_parser_set_decl_spec_type): Refine test for
	redefinition of built-in types.

	PR c++/16193
	* g++.dg/parse/redef1.C: New test.

From-SVN: r83740
This commit is contained in:
Mark Mitchell 2004-06-27 18:56:46 +00:00 committed by Mark Mitchell
parent b6ded5bdea
commit f84b6c964e
4 changed files with 36 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2004-06-27 Mark Mitchell <mark@codesourcery.com>
PR c++/16193
* parser.c (cp_parser_set_decl_spec_type): Refine test for
redefinition of built-in types.
2004-06-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (pp_template_argument_list_start): Remove.

View File

@ -15427,13 +15427,21 @@ cp_parser_set_decl_spec_type (cp_decl_specifier_seq *decl_specs,
bool user_defined_p)
{
decl_specs->any_specifiers_p = true;
if (decl_specs->type)
{
if (decl_specs->specs[(int)ds_typedef] && !user_defined_p)
decl_specs->redefined_builtin_type = type_spec;
else
decl_specs->multiple_types_p = true;
}
/* If the user tries to redeclare a built-in type (with, for example,
in "typedef int wchar_t;") we remember that this is what
happened. In system headers, we ignore these declarations so
that G++ can work with system headers that are not C++-safe. */
if (decl_specs->specs[(int) ds_typedef]
&& !user_defined_p
&& (decl_specs->type
|| decl_specs->specs[(int) ds_long]
|| decl_specs->specs[(int) ds_short]
|| decl_specs->specs[(int) ds_unsigned]
|| decl_specs->specs[(int) ds_signed]))
decl_specs->redefined_builtin_type = type_spec;
else if (decl_specs->type)
decl_specs->multiple_types_p = true;
else
{
decl_specs->type = type_spec;

View File

@ -1,3 +1,8 @@
2004-06-27 Mark Mitchell <mark@codesourcery.com>
PR c++/16193
* g++.dg/parse/redef1.C: New test.
2004-06-27 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.c-torture/compile/20021123-1.c: Remove duplicate of

View File

@ -0,0 +1,10 @@
// { dg-options "" }
// PR c++/16193
# 1 "syshdr1.C"
# 1 "syshdr1.h" 1 3
// Redefinitions of built-in types are allowed in system headers so
// that G++ will work with system headers that are not fully
// C++-aware.
typedef long wchar_t;
# 2 "syshdr1.C" 2