Diagnose _Bool as a C99 extension.

llvm-svn: 370108
This commit is contained in:
Aaron Ballman 2019-08-27 20:33:05 +00:00
parent 528f5da6d8
commit 27e66bf710
2 changed files with 6 additions and 0 deletions

View File

@ -3777,6 +3777,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
break; break;
case tok::kw_bool: case tok::kw_bool:
case tok::kw__Bool: case tok::kw__Bool:
if (Tok.is(tok::kw__Bool) && !getLangOpts().C99)
Diag(Tok, diag::ext_c99_feature) << Tok.getName();
if (Tok.is(tok::kw_bool) && if (Tok.is(tok::kw_bool) &&
DS.getTypeSpecType() != DeclSpec::TST_unspecified && DS.getTypeSpecType() != DeclSpec::TST_unspecified &&
DS.getStorageClassSpec() == DeclSpec::SCS_typedef) { DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {

View File

@ -6,3 +6,6 @@ double _Imaginary foo; // ext-warning {{'_Imaginary' is a C99 extension}} \
// expected-error {{imaginary types are not supported}} // expected-error {{imaginary types are not supported}}
double _Complex bar; // ext-warning {{'_Complex' is a C99 extension}} double _Complex bar; // ext-warning {{'_Complex' is a C99 extension}}
#if !defined(__cplusplus)
_Bool baz; // ext-warning {{'_Bool' is a C99 extension}}
#endif