re PR c++/27808 (ICE with invalid friend declaration)
PR c++/27808 * parser.c (cp_parser_decl_specifier_seq): Issue errors about "friend" specifiers that do not appear in class scopes. PR c++/27808 * g++.dg/parse/friend6.C: New test. From-SVN: r114259
This commit is contained in:
parent
7edd9592be
commit
c7baf9e9fb
|
@ -1,5 +1,9 @@
|
||||||
2006-05-30 Mark Mitchell <mark@codesourcery.com>
|
2006-05-30 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
PR c++/27808
|
||||||
|
* parser.c (cp_parser_decl_specifier_seq): Issue errors about
|
||||||
|
"friend" specifiers that do not appear in class scopes.
|
||||||
|
|
||||||
PR c++/27803
|
PR c++/27803
|
||||||
* class.c (check_bitfield_decl): Ensure that all bitfields have
|
* class.c (check_bitfield_decl): Ensure that all bitfields have
|
||||||
integral type.
|
integral type.
|
||||||
|
|
|
@ -7425,9 +7425,17 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
|
||||||
/* decl-specifier:
|
/* decl-specifier:
|
||||||
friend */
|
friend */
|
||||||
case RID_FRIEND:
|
case RID_FRIEND:
|
||||||
|
if (!at_class_scope_p ())
|
||||||
|
{
|
||||||
|
error ("%<friend%> used outside of class");
|
||||||
|
cp_lexer_purge_token (parser->lexer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
++decl_specs->specs[(int) ds_friend];
|
++decl_specs->specs[(int) ds_friend];
|
||||||
/* Consume the token. */
|
/* Consume the token. */
|
||||||
cp_lexer_consume_token (parser->lexer);
|
cp_lexer_consume_token (parser->lexer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* function-specifier:
|
/* function-specifier:
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2006-05-30 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
PR c++/27808
|
||||||
|
* g++.dg/parse/friend6.C: New test.
|
||||||
|
|
||||||
2006-05-30 Asher Langton <langton2@llnl.gov>
|
2006-05-30 Asher Langton <langton2@llnl.gov>
|
||||||
|
|
||||||
* gfortran.dg/cray_pointers_7.f90: New test.
|
* gfortran.dg/cray_pointers_7.f90: New test.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
// PR c++/27808
|
||||||
|
|
||||||
|
template<typename T> friend void T::foo; // { dg-error "friend|invalid" }
|
Loading…
Reference in New Issue