Commit f84b6c96 by Mark Mitchell Committed by Mark Mitchell

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
parent b6ded5bd
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> 2004-06-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (pp_template_argument_list_start): Remove. * error.c (pp_template_argument_list_start): Remove.
......
...@@ -15427,13 +15427,21 @@ cp_parser_set_decl_spec_type (cp_decl_specifier_seq *decl_specs, ...@@ -15427,13 +15427,21 @@ cp_parser_set_decl_spec_type (cp_decl_specifier_seq *decl_specs,
bool user_defined_p) bool user_defined_p)
{ {
decl_specs->any_specifiers_p = true; decl_specs->any_specifiers_p = true;
if (decl_specs->type)
{ /* If the user tries to redeclare a built-in type (with, for example,
if (decl_specs->specs[(int)ds_typedef] && !user_defined_p) in "typedef int wchar_t;") we remember that this is what
decl_specs->redefined_builtin_type = type_spec; happened. In system headers, we ignore these declarations so
else that G++ can work with system headers that are not C++-safe. */
decl_specs->multiple_types_p = true; 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 else
{ {
decl_specs->type = type_spec; decl_specs->type = type_spec;
......
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> 2004-06-27 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.c-torture/compile/20021123-1.c: Remove duplicate of * gcc.c-torture/compile/20021123-1.c: Remove duplicate of
......
// { 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
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