[cfe-commits] [libcxx] r145624 - in /libcxx/trunk: include/ lib/ src/

Jonathan Sauer jonathan.sauer at gmx.de
Mon Jan 23 00:38:37 PST 2012


Hello,

a bit late, but ...

> Modified: libcxx/trunk/include/algorithm
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=145624&r1=145623&r2=145624&view=diff
> ==============================================================================
> --- libcxx/trunk/include/algorithm (original)
> +++ libcxx/trunk/include/algorithm Thu Dec  1 14:21:04 2011
> @@ -2678,8 +2712,8 @@
> 
>     result_type operator()();
> 
> -    static const/*expr*/ result_type min() {return _Min;}
> -    static const/*expr*/ result_type max() {return _Max;}
> +    static constexpr result_type min() {return _Min;}
> +    static constexpr result_type max() {return _Max;}
> 
>     friend __rs_default __rs_get();
> };

When compiling with clang's preliminary support for constexpr, this results in a compile-time error, as the
class has non-constexpr constructors and a destructor, both of which make the class non-literal, meaning it
cannot have constexpr methods (FDIS 7.15p8 and 3.9p10).

7.15p8:
| A constexpr specifier for a non-static member function [...]. The class of which that function is a member
| shall be a literal type (3.9)

3.9p10:
| A type is a literal type if it is: [...]
| - a class type (Clause 9) that has all of the following properties:
|   - it has a trivial destructor,
|   - every constructor call and full-expression in the brace-or-equal-initializers for non-static data
|     members (if any) is a constant expression (5.19),


Jonathan





More information about the cfe-commits mailing list