]> granicus.if.org Git - clang/commitdiff
Add __has_feature(cxx_defaulted_functions) for querying "defaulted
authorDouglas Gregor <dgregor@apple.com>
Tue, 1 Nov 2011 01:19:34 +0000 (01:19 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 1 Nov 2011 01:19:34 +0000 (01:19 +0000)
functions", from Michel Morin!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143411 91177308-0d34-0410-b5e6-96231b3b80d8

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

index becdbfac4d18c5b362d975f8000aa660753fa63f..34e205613be25399b24ac0ebcfde23b60400587a 100644 (file)
@@ -46,6 +46,7 @@
     <li><a href="#cxx_constexpr">C++11 generalized constant expressions</a></li>
     <li><a href="#cxx_decltype">C++11 <tt>decltype()</tt></a></li>
     <li><a href="#cxx_default_function_template_args">C++11 default template arguments in function templates</a></li>
+    <li><a href="#cxx_defaulted_functions">C++11 defaulted functions</a></li>
     <li><a href="#cxx_delegating_constructor">C++11 delegating constructors</a></li>
     <li><a href="#cxx_deleted_functions">C++11 deleted functions</a></li>
     <li><a href="#cxx_explicit_conversions">C++11 explicit conversion functions</a></li>
@@ -509,6 +510,12 @@ enabled. Clang does not currently implement this feature.</p>
 <tt>__has_extension(cxx_default_function_template_args)</tt> to determine
 if support for default template arguments in function templates is enabled.</p>
 
+<h4 id="cxx_defaulted_functions">C++11 <tt>default</tt>ed functions</h4>
+
+<p>Use <tt>__has_feature(cxx_defaulted_functions)</tt> or
+<tt>__has_extension(cxx_defaulted_functions)</tt> to determine if support for
+defaulted function definitions (with <tt>= default</tt>) is enabled.</p>
+
 <h4 id="cxx_delegating_constructors">C++11 delegating constructors</h4>
 
 <p>Use <tt>__has_feature(cxx_delegating_constructors)</tt> to determine if
index 7557f2e0fe0bd330df6bb43831f70eb7f2687c6e..fd04b8a37945fbd617ce1dd0c4e01823f3d25cb4 100644 (file)
@@ -628,6 +628,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
          //.Case("cxx_constexpr", false);
            .Case("cxx_decltype", LangOpts.CPlusPlus0x)
            .Case("cxx_default_function_template_args", LangOpts.CPlusPlus0x)
+           .Case("cxx_defaulted_functions", LangOpts.CPlusPlus0x)
            .Case("cxx_delegating_constructors", LangOpts.CPlusPlus0x)
            .Case("cxx_deleted_functions", LangOpts.CPlusPlus0x)
            .Case("cxx_explicit_conversions", LangOpts.CPlusPlus0x)
index f2b4576b57e96ad33592a5e9b9c9309c29841e9c..eff9cfb892fd1fbeb37d656d1252941915bc72dd 100644 (file)
@@ -79,6 +79,14 @@ int no_deleted_functions();
 // CHECK-0X: has_deleted_functions
 // CHECK-NO-0X: no_deleted_functions
 
+#if __has_feature(cxx_defaulted_functions)
+int has_defaulted_functions();
+#else
+int no_defaulted_functions();
+#endif
+
+// CHECK-0X: has_defaulted_functions
+// CHECK-NO-0X: no_defaulted_functions
 
 #if __has_feature(cxx_rvalue_references)
 int has_rvalue_references();