cp_parser_pragma (parser, pragma_external, NULL);
else if (token->type == CPP_SEMICOLON)
{
- /* A declaration consisting of a single semicolon is
- invalid. Allow it unless we're being pedantic. */
cp_lexer_consume_token (parser->lexer);
- pedwarn (input_location, OPT_Wpedantic, "extra %<;%>");
+ /* A declaration consisting of a single semicolon is invalid
+ * before C++11. Allow it unless we're being pedantic. */
+ if (cxx_dialect < cxx11)
+ pedwarn (input_location, OPT_Wpedantic, "extra %<;%>");
}
else
/* Parse the declaration itself. */
// elaborated-type-specifier with class key, or an enum-specifier. The
// declaration below contains neither.
-// g++ fails to flag errors for such usage.
+// Since C++11 this is allowed as an empty-declaration.
+
+// g++ fails to flag errors for such usage in C++98.
// keywords: semicolon, vacuous, file scope, declaration
int i;
-; // { dg-error "extra ';'" }
+; // { dg-error "extra ';'" "" { target c++98_only } 0 }
int main () { return 0; }
#endif
inline int max(int a, int b) {return a > b ? a : b;}; // { dg-message "note" }
- // { dg-error "extra ';'" "extra ;" { target *-*-* } .-1 }
+ // { dg-error "extra ';'" "extra ;" { target c++98_only } .-1 }
inline double max(double a, double b) {return a > b ? a : b;}; // { dg-message "note" } candidate
- // { dg-error "extra ';'" "extra ;" { target *-*-* } .-1 }
+ // { dg-error "extra ';'" "extra ;" { target c++98_only } .-1 }
int main() {
static void foo(int i, int j, double x, double y) ;// { dg-error "" } .*