[PATCH] add __is_constructible to the list of features queryable by __has_feature

Marshall Clow mclow.lists at gmail.com
Mon Mar 17 15:28:45 PDT 2014


On Mar 17, 2014, at 2:53 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> I seem to recall someone suggesting that we move away from using __has_feature for these checks.

If you mean the discussion between you, Aaron, and Alp - then yes, I recall it too.
But it seemed to peter out w/o a resolution.

I’m not wedded to this approach; but I would like to be able to tell if a compiler supports __is_constructible(Foo).
I believe that the “current way” is to check using __has_feature(is_constructible), but I’m open to other methods.

— Marshall


> 
> On Mon, Mar 17, 2014 at 1:36 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> Note: Clang already implements “__is_constructible” - this just makes it checkable.
> With this check I can use it in libc++.
> 
> — Marshall
> 
> 
> Index: lib/Lex/PPMacroExpansion.cpp
> ===================================================================
> --- lib/Lex/PPMacroExpansion.cpp        (revision 204039)
> +++ lib/Lex/PPMacroExpansion.cpp        (working copy)
> @@ -989,6 +989,7 @@
>             .Case("is_sealed", LangOpts.MicrosoftExt)
>             .Case("is_trivial", LangOpts.CPlusPlus)
>             .Case("is_trivially_assignable", LangOpts.CPlusPlus)
> +           .Case("is_constructible", LangOpts.CPlusPlus)
>             .Case("is_trivially_constructible", LangOpts.CPlusPlus)
>             .Case("is_trivially_copyable", LangOpts.CPlusPlus)
>             .Case("is_union", LangOpts.CPlusPlus)
> Index: test/Lexer/has_feature_type_traits.cpp
> ===================================================================
> --- test/Lexer/has_feature_type_traits.cpp      (revision 204039)
> +++ test/Lexer/has_feature_type_traits.cpp      (working copy)
> @@ -100,6 +100,11 @@
>  #endif
>  // CHECK: int is_standard_layout();
> 
> +#if __has_feature(is_constructible)
> +int is_constructible();
> +#endif
> +// CHECK: int is_constructible();
> +
>  #if __has_feature(is_trivially_copyable)
>  int is_trivially_copyable();
>  #endif
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140317/edc37084/attachment.html>


More information about the cfe-commits mailing list