зеркало из https://github.com/microsoft/clang-1.git
PR4304: Add warning for designators in strict c89 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130117 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6e089c687c
Коммит
a47317bbee
|
@ -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}} */
|
||||
|
|
Загрузка…
Ссылка в новой задаче