From: Douglas Gregor Date: Tue, 1 Nov 2011 01:19:34 +0000 (+0000) Subject: Add __has_feature(cxx_defaulted_functions) for querying "defaulted X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f695a6952f111e79c685301c292755908473f297;p=clang Add __has_feature(cxx_defaulted_functions) for querying "defaulted functions", from Michel Morin! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143411 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index becdbfac4d..34e205613b 100644 --- a/docs/LanguageExtensions.html +++ b/docs/LanguageExtensions.html @@ -46,6 +46,7 @@
  • C++11 generalized constant expressions
  • C++11 decltype()
  • C++11 default template arguments in function templates
  • +
  • C++11 defaulted functions
  • C++11 delegating constructors
  • C++11 deleted functions
  • C++11 explicit conversion functions
  • @@ -509,6 +510,12 @@ enabled. Clang does not currently implement this feature.

    __has_extension(cxx_default_function_template_args) to determine if support for default template arguments in function templates is enabled.

    +

    C++11 defaulted functions

    + +

    Use __has_feature(cxx_defaulted_functions) or +__has_extension(cxx_defaulted_functions) to determine if support for +defaulted function definitions (with = default) is enabled.

    +

    C++11 delegating constructors

    Use __has_feature(cxx_delegating_constructors) to determine if diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 7557f2e0fe..fd04b8a379 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -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) diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index f2b4576b57..eff9cfb892 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -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();