diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index f8e67199a984..7ce5017e18b6 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -160,6 +160,8 @@ def err_illegal_decl_reference_to_reference : Error< "%0 declared as a reference to a reference">; def ext_rvalue_reference : ExtWarn< "rvalue references are a C++0x extension">, InGroup; +def ext_ref_qualifier : ExtWarn< + "reference qualifiers on functions are a C++0x extension">, InGroup; def ext_inline_namespace : ExtWarn< "inline namespaces are a C++0x feature">, InGroup; def err_argument_required_after_attribute : Error< diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 29f9921217d9..c4fce66b6577 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3102,7 +3102,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // Parse ref-qualifier[opt] if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) { if (!getLang().CPlusPlus0x) - Diag(Tok, diag::ext_rvalue_reference); + Diag(Tok, diag::ext_ref_qualifier); RefQualifierIsLValueRef = Tok.is(tok::amp); RefQualifierLoc = ConsumeToken(); @@ -3353,7 +3353,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // Parse ref-qualifier[opt] if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) { if (!getLang().CPlusPlus0x) - Diag(Tok, diag::ext_rvalue_reference); + Diag(Tok, diag::ext_ref_qualifier); RefQualifierIsLValueRef = Tok.is(tok::amp); RefQualifierLoc = ConsumeToken(); diff --git a/clang/test/Parser/cxx0x-in-cxx98.cpp b/clang/test/Parser/cxx0x-in-cxx98.cpp new file mode 100644 index 000000000000..e0cbc23f5811 --- /dev/null +++ b/clang/test/Parser/cxx0x-in-cxx98.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s + +inline namespace N { // expected-warning{{inline namespaces are a C++0x feature}} +struct X { + template // expected-warning{{variadic templates are a C++0x extension}} + void f(Args &&...) &; // expected-warning{{rvalue references are a C++0x extension}} \ + // expected-warning{{reference qualifiers on functions are a C++0x extension}} +}; +} +