[PATCH] [libc++] In C++11 GNU extension mode, start emulating libstdc++'s use of constexpr.

Richard Smith richard at metafoo.co.uk
Tue Nov 26 15:22:59 PST 2013

  I've done no detailed review of the guts of the patch, but I have one high-level question: do we actually want to support a GNU-compatibility mode here, or do we instead want to provide our own extra-`constexpr` extension (in which we intend to mark at least the same set of functions as libstdc++ does)?

  I think the latter makes a lot more sense. I also see no reason to restrict this to things that are already `constexpr` in c++14. So I'm thinking of something like:

    #if defined(_LIBCPP_CONSTEXPR_EXTENSIONS) && __cplusplus >= 201103L
    #define _LIBCPP_CONSTEXPR_AS_EXTENSION constexpr

  ... then ...

    void f() {...} // constexpr in c++14 mode only

    int g(); // constexpr in c++11 and c++14 in extensions mode, otherwise not

    int h(); // constexpr in c++14, constexpr in c++11 in extensions mode


More information about the cfe-commits mailing list