[cfe-commits] r124316 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseDecl.cpp test/Parser/cxx0x-in-cxx98.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 26 12:35:32 PST 2011
Author: dgregor
Date: Wed Jan 26 14:35:32 2011
New Revision: 124316
URL: http://llvm.org/viewvc/llvm-project?rev=124316&view=rev
Log:
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 '&'.
Added:
cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp (with props)
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseDecl.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=124316&r1=124315&r2=124316&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Jan 26 14:35:32 2011
@@ -160,6 +160,8 @@
"%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<
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=124316&r1=124315&r2=124316&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Jan 26 14:35:32 2011
@@ -3102,7 +3102,7 @@
// 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 @@
// 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();
Added: cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp?rev=124316&view=auto
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp (added)
+++ cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp Wed Jan 26 14:35:32 2011
@@ -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}}
+};
+}
+
Propchange: cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/Parser/cxx0x-in-cxx98.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list