forked from OSchip/llvm-project
Improve the extension warning for the use of ref-qualifiers, to
distinguish them from rvalue references. Using the rvalue-references warning was weird when the ref-qualifier was '&'. llvm-svn: 124316
This commit is contained in:
parent
5143d646b9
commit
a52713096d
|
@ -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<CXX0x>;
|
||||
def ext_ref_qualifier : ExtWarn<
|
||||
"reference qualifiers on functions are a C++0x extension">, InGroup<CXX0x>;
|
||||
def ext_inline_namespace : ExtWarn<
|
||||
"inline namespaces are a C++0x feature">, InGroup<CXX0x>;
|
||||
def err_argument_required_after_attribute : Error<
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<typename ...Args> // 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}}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue