forked from OSchip/llvm-project
PR4304: Add warning for designators in strict c89 mode.
llvm-svn: 130117
This commit is contained in:
parent
a076199e71
commit
ea7b85bfe0
|
@ -1976,6 +1976,9 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
|
|||
Loc, GNUSyntax, Init.takeAs<Expr>());
|
||||
|
||||
if (getLangOptions().CPlusPlus)
|
||||
Diag(DIE->getLocStart(), diag::ext_designated_init_cxx)
|
||||
<< DIE->getSourceRange();
|
||||
else if (!getLangOptions().C99)
|
||||
Diag(DIE->getLocStart(), diag::ext_designated_init)
|
||||
<< DIE->getSourceRange();
|
||||
|
||||
|
|
|
@ -80,3 +80,5 @@ void test13b() {
|
|||
|
||||
/* Make sure we allow *test14 as a "function designator" */
|
||||
int test14() { return (&*test14)(); }
|
||||
|
||||
int test15[5] = { [2] = 1 }; /* expected-warning {{designated initializers are a C99 feature}} */
|
||||
|
|
Loading…
Reference in New Issue