]> granicus.if.org Git - clang/commitdiff
Advertize support for constexpr.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 14 Feb 2012 22:56:17 +0000 (22:56 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 14 Feb 2012 22:56:17 +0000 (22:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150524 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LanguageExtensions.html
lib/Lex/PPMacroExpansion.cpp
test/Lexer/has_feature_cxx0x.cpp

index 7693d24154084336d8144d1b166835eff9b73f62..09832db1ca0227ce32ff843777613bfc20d47d68 100644 (file)
@@ -668,7 +668,7 @@ parsing with C++11's square bracket notation is enabled.</p>
 
 <p>Use <tt>__has_feature(cxx_constexpr)</tt> to determine if support
 for generalized constant expressions (e.g., <tt>constexpr</tt>) is
-enabled. Clang does not currently implement this feature.</p> 
+enabled.</p>
 
 <h4 id="cxx_decltype">C++11 <tt>decltype()</tt></h4>
 
index 3fe3ab3b195d097a3a9bb79d2c4762cadbeea3c0..a285c30d5cf6acbafd7126303cb91d9a1d8105ce 100644 (file)
@@ -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)
index f02f1031add312f0bab21f88f4a34e19f35bb0eb..17ed6fbfafd711a66c64e456ba083082c6cd6073 100644 (file)
@@ -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