Commit 77a24286 by Paolo Carlini Committed by Paolo Carlini

decl.c (grokdeclarator): Fix location of error message about static data member definition.

/cp
2018-12-12  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (grokdeclarator): Fix location of error message about
	static data member definition.

/testsuite
2018-12-12  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/other/static5.C: New.

From-SVN: r267066
parent 293267bc
2018-12-12 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grokdeclarator): Fix location of error message about
static data member definition.
2018-12-12 Jakub Jelinek <jakub@redhat.com>
PR c++/88446
......
......@@ -12724,7 +12724,8 @@ grokdeclarator (const cp_declarator *declarator,
DECL_CONTEXT (decl) = ctype;
if (staticp == 1)
{
permerror (input_location, "%<static%> may not be used when defining "
permerror (declspecs->locations[ds_storage_class],
"%<static%> may not be used when defining "
"(as opposed to declaring) a static data member");
staticp = 0;
storage_class = sc_none;
......
2018-12-12 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/other/static5.C: New.
2018-12-12 Segher Boessenkool <segher@kernel,crashing.org>
PR testsuite/88318
......
struct S
{
static int i;
const static double d;
};
static int S::i; // { dg-error "1:.static. may not be used" }
const static double S::d = 1.0; // { dg-error "7:.static. may not be used" }
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