re PR c++/21495 (internal compiler error: Segmentation fault)

PR c++/21495
	* decl.c (grokdeclarator): Fix "storage class specified for"
	error reporting.

	* g++.dg/parse/extern1.C: New test.
	* g++.dg/tls/diag-2.C: Adjust expected error message wording.

From-SVN: r99960
This commit is contained in:
Jakub Jelinek 2005-05-19 09:37:45 +02:00 committed by Jakub Jelinek
parent f0cd747eb3
commit 389c6c8b5b
5 changed files with 28 additions and 25 deletions

View file

@ -1,3 +1,9 @@
2005-05-19 Jakub Jelinek <jakub@redhat.com>
PR c++/21495
* decl.c (grokdeclarator): Fix "storage class specified for"
error reporting.
2005-05-19 Kazu Hirata <kazu@cs.umass.edu>
* parser.c: Fix comment typos.

View file

@ -7002,30 +7002,7 @@ grokdeclarator (const cp_declarator *declarator,
else
{
if (decl_context == FIELD)
{
tree tmp = NULL_TREE;
int op = 0;
if (declarator)
{
/* Avoid trying to get an operand off an identifier node. */
if (declarator->kind != cdk_id)
tmp = declarator->declarator->u.id.unqualified_name;
else
tmp = declarator->u.id.unqualified_name;
op = IDENTIFIER_OPNAME_P (tmp);
if (IDENTIFIER_TYPENAME_P (tmp))
{
if (is_typename_at_global_scope (tmp))
name = IDENTIFIER_POINTER (tmp);
else
name = "<invalid operator>";
}
}
error ("storage class specified for %s %qs",
op ? "member operator" : "field",
name);
}
error ("storage class specified for %qs", name);
else
{
if (decl_context == PARM || decl_context == CATCHPARM)

View file

@ -1,3 +1,9 @@
2005-05-19 Jakub Jelinek <jakub@redhat.com>
PR c++/21495
* g++.dg/parse/extern1.C: New test.
* g++.dg/tls/diag-2.C: Adjust expected error message wording.
2005-05-19 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/c99-math.h: New.

View file

@ -0,0 +1,14 @@
// PR c++/21495
// { dg-do compile }
class A
{
extern void *copy (void) // { dg-error "storage class specified" }
{
return 0;
}
extern A &operator= (const A &) // { dg-error "storage class specified" }
{
return *this;
}
};

View file

@ -21,5 +21,5 @@ __thread void f4 () { } /* { dg-error "invalid for function" } */
void bar(__thread int p1); /* { dg-error "(invalid in parameter)|(specified for parameter)" } */
struct A {
__thread int i; /* { dg-error "specified for field" } */
__thread int i; /* { dg-error "storage class specified" } */
};