"C requires a comma prior to the ellipsis in a variadic function type">;
def err_unexpected_typedef_ident : Error<
"unexpected type name %0: expected identifier">;
+def ext_gnu_decltype : Extension<
+ "'__decltype' type specifier is a GNU extension">,
+ InGroup<GNU>, DefaultIgnore;
+def warn_cxx98_compat_decltype : Warning<
+ "'decltype' type specifier is incompatible with C++98">,
+ InGroup<CXX98Compat>, DefaultIgnore;
def err_unexpected_scope_on_base_decltype : Error<
"unexpected namespace scope prior to decltype">;
def err_expected_class_name : Error<"expected class name">;
InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
// C++11 decltype
-def warn_cxx98_compat_decltype : Warning<
- "'decltype' type specifier is incompatible with C++98">,
- InGroup<CXX98Compat>, DefaultIgnore;
def err_decltype_in_declarator : Error<
"'decltype' cannot be used to name a declaration">;
return EndLoc;
}
} else {
+ Diag(Tok, Tok.getIdentifierInfo()->isStr("decltype")
+ ? diag::warn_cxx98_compat_decltype : diag::ext_gnu_decltype);
+
ConsumeToken();
BalancedDelimiterTracker T(*this, tok::l_paren);
if (TypeSpecType == TST_char16 || TypeSpecType == TST_char32)
Diag(D, TSTLoc, diag::warn_cxx98_compat_unicode_type)
<< (TypeSpecType == TST_char16 ? "char16_t" : "char32_t");
- if (TypeSpecType == TST_decltype)
- Diag(D, TSTLoc, diag::warn_cxx98_compat_decltype);
if (Constexpr_specified)
Diag(D, ConstexprLoc, diag::warn_cxx98_compat_constexpr);
char32_t c32 = 0; // expected-warning {{'char32_t' type specifier is incompatible with C++98}}
constexpr int const_expr = 0; // expected-warning {{'constexpr' specifier is incompatible with C++98}}
decltype(const_expr) decl_type = 0; // expected-warning {{'decltype' type specifier is incompatible with C++98}}
+__decltype(const_expr) decl_type2 = 0; // ok
void no_except() noexcept; // expected-warning {{noexcept specifications are incompatible with C++98}}
bool no_except_expr = noexcept(1 + 1); // expected-warning {{noexcept expressions are incompatible with C++98}}
void *null = nullptr; // expected-warning {{'nullptr' is incompatible with C++98}}
-// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s -Wgnu
extern int x;
-__decltype(1) x = 3;
+__decltype(1) x = 3; // expected-warning {{is a GNU extension}}