aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-25 02:17:32 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-25 02:17:32 +0000
commit16cf8f5b6f582876b64e132715280fc473f876b9 (patch)
tree0f05a6d0ce688c8d0776dc2039713625a2894ebe
parent14429b918bd2f4cb52abc75546a7fe37142054ca (diff)
Downgrade the error about rvalue references to an extension warning
and turn on __has_feature(cxx_rvalue_references). The core rvalue references proposal seems to be fully implemented now, pending lots more testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124169 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td8
-rw-r--r--lib/Lex/PPMacroExpansion.cpp4
-rw-r--r--lib/Parse/ParseDecl.cpp2
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp4
-rw-r--r--test/Parser/cxx-reference.cpp2
5 files changed, 10 insertions, 10 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index ee1bb2cdfb..f8e67199a9 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -158,10 +158,10 @@ def err_invalid_reference_qualifier_application : Error<
"'%0' qualifier may not be applied to a reference">;
def err_illegal_decl_reference_to_reference : Error<
"%0 declared as a reference to a reference">;
-def err_rvalue_reference : Error<
- "rvalue references are only allowed in C++0x">;
-def ext_inline_namespace : Extension<
- "inline namespaces are a C++0x feature">;
+def ext_rvalue_reference : ExtWarn<
+ "rvalue references 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<
"argument required after attribute">;
def err_missing_param : Error<"expected parameter declarator">;
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 0bfadad439..cde5d22a75 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -555,10 +555,10 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("ownership_holds", true)
.Case("ownership_returns", true)
.Case("ownership_takes", true)
- .Case("cxx_inline_namespaces", true)
+ .Case("cxx_inline_namespaces", LangOpts.CPlusPlus)
//.Case("cxx_lambdas", false)
//.Case("cxx_nullptr", false)
- //.Case("cxx_rvalue_references", false)
+ .Case("cxx_rvalue_references", LangOpts.CPlusPlus)
.Case("cxx_variadic_templates", LangOpts.CPlusPlus)
.Case("tls", PP.getTargetInfo().isTLSSupported())
.Default(false);
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 355ba022f6..f4a79077a9 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2722,7 +2722,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
// Complain about rvalue references in C++03, but then go on and build
// the declarator.
if (Kind == tok::ampamp && !getLang().CPlusPlus0x)
- Diag(Loc, diag::err_rvalue_reference);
+ Diag(Loc, diag::ext_rvalue_reference);
// C++ 8.3.2p1: cv-qualified references are ill-formed except when the
// cv-qualifiers are introduced through the use of a typedef or of a
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index dcd46b7514..5d1d0b864c 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -77,8 +77,8 @@ int rvalue_references();
int no_rvalue_references();
#endif
-// CHECK-0X: no_rvalue_references
-// CHECK-NO-0X: no_rvalue_references
+// CHECK-0X: rvalue_references
+// CHECK-NO-0X: rvalue_references
#if __has_feature(cxx_variadic_templates)
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
index 46f9fb07db..fae938bcaa 100644
--- a/test/Parser/cxx-reference.cpp
+++ b/test/Parser/cxx-reference.cpp
@@ -18,4 +18,4 @@ int & volatile Y = val; // expected-error {{'volatile' qualifier may not be appl
int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
expected-error {{'volatile' qualifier may not be applied}} */
-typedef int && RV; // expected-error {{rvalue references are only allowed in C++0x}}
+typedef int && RV; // expected-warning {{rvalue references are a C++0x extension}}