]> granicus.if.org Git - clang/commitdiff
Downgrade the error about rvalue references to an extension warning
authorDouglas Gregor <dgregor@apple.com>
Tue, 25 Jan 2011 02:17:32 +0000 (02:17 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 25 Jan 2011 02:17:32 +0000 (02:17 +0000)
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

include/clang/Basic/DiagnosticParseKinds.td
lib/Lex/PPMacroExpansion.cpp
lib/Parse/ParseDecl.cpp
test/Lexer/has_feature_cxx0x.cpp
test/Parser/cxx-reference.cpp

index ee1bb2cdfbffa60352556969500b8fd3afca3baa..f8e67199a984d3e944d89ad066a43792d562b3f5 100644 (file)
@@ -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">;
index 0bfadad4398aa6eb2002616804f3f8751031cfa7..cde5d22a75827bd30165aaf8ad9a825c063b8cc8 100644 (file)
@@ -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);
index 355ba022f6ca15041cd2e8ae6ed3649c2d4f07e5..f4a79077a925df4ec302f11375ae0b59818b10f4 100644 (file)
@@ -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
index dcd46b75149d524830286f3db630caf812da33e7..5d1d0b864c5512efaa5528539ce58e3b14586d7d 100644 (file)
@@ -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)
index 46f9fb07dba05c951af2a7cc95e9ee8536e0b49c..fae938bcaab01dc40609e3a58db26ffba8b0e24e 100644 (file)
@@ -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}}