decl2.c (grokfield): Issue error on illegal data member declaration.
* decl2.c (grokfield): Issue error on illegal data member declaration. From-SVN: r33220
This commit is contained in:
parent
ab36bd3ed4
commit
009e98457a
|
@ -1,3 +1,8 @@
|
||||||
|
2000-04-17 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
* decl2.c (grokfield): Issue error on illegal data member
|
||||||
|
declaration.
|
||||||
|
|
||||||
Mon Apr 17 17:11:16 2000 Mark P Mitchell <mark@codesourcery.com>
|
Mon Apr 17 17:11:16 2000 Mark P Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
* method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL.
|
* method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL.
|
||||||
|
|
|
@ -1572,7 +1572,23 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
||||||
|| TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
|
|| TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
|
||||||
&& parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
|
&& parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
|
||||||
{
|
{
|
||||||
init = TREE_OPERAND (declarator, 1);
|
/* It's invalid to try to initialize a data member using a
|
||||||
|
functional notation, e.g.:
|
||||||
|
|
||||||
|
struct S {
|
||||||
|
static int i (3);
|
||||||
|
};
|
||||||
|
|
||||||
|
Explain that to the user. */
|
||||||
|
static int explained_p;
|
||||||
|
|
||||||
|
cp_error ("invalid data member initiailization");
|
||||||
|
if (!explained_p)
|
||||||
|
{
|
||||||
|
cp_error ("use `=' to initialize static data members");
|
||||||
|
explained_p = 1;
|
||||||
|
}
|
||||||
|
|
||||||
declarator = TREE_OPERAND (declarator, 0);
|
declarator = TREE_OPERAND (declarator, 0);
|
||||||
flags = 0;
|
flags = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Build don't link:
|
||||||
|
// Origin: Dima Volodin <dvv@dvv.org>
|
||||||
|
|
||||||
|
class C {
|
||||||
|
static int const N (1000);
|
||||||
|
};
|
Loading…
Reference in New Issue