From: Richard Smith
Date: Tue, 14 Feb 2012 22:56:17 +0000 (+0000)
Subject: Advertize support for constexpr.
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5216aaf803609d25eb8514266dd8531812b4877;p=clang
Advertize support for constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150524 91177308-0d34-0410-b5e6-96231b3b80d8
---
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html
index 7693d24154..09832db1ca 100644
--- a/docs/LanguageExtensions.html
+++ b/docs/LanguageExtensions.html
@@ -668,7 +668,7 @@ parsing with C++11's square bracket notation is enabled.
Use __has_feature(cxx_constexpr) to determine if support
for generalized constant expressions (e.g., constexpr) is
-enabled. Clang does not currently implement this feature.
+enabled.
C++11 decltype()
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 3fe3ab3b19..a285c30d5c 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -638,7 +638,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("cxx_atomic", LangOpts.CPlusPlus0x)
.Case("cxx_attributes", LangOpts.CPlusPlus0x)
.Case("cxx_auto_type", LangOpts.CPlusPlus0x)
- //.Case("cxx_constexpr", false);
+ .Case("cxx_constexpr", LangOpts.CPlusPlus0x)
.Case("cxx_decltype", LangOpts.CPlusPlus0x)
.Case("cxx_default_function_template_args", LangOpts.CPlusPlus0x)
.Case("cxx_defaulted_functions", LangOpts.CPlusPlus0x)
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index f02f1031ad..17ed6fbfaf 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -217,3 +217,12 @@ int no_unicode_literals();
// CHECK-0X: has_unicode_literals
// CHECK-NO-0X: no_unicode_literals
+
+#if __has_feature(cxx_constexpr)
+int has_constexpr();
+#else
+int no_constexpr();
+#endif
+
+// CHECK-0X: has_constexpr
+// CHECK-NO-0X: no_constexpr