On Aug 20, 2013, at 8:12 PM, David Blaikie <[email protected]> wrote:

> On Tue, Aug 20, 2013 at 11:11 AM, Marshall Clow <[email protected]> wrote:
>> http://cplusplus.github.io/LWG/lwg-defects.html#2145
>> 
>> Mark the constructor for std::error_category as inline and constexpr.
>> Leave the (existing, out-of-line, non-constexpr) in the dylib for 
>> compatibility with existing programs)
>> No tests, because I don't know how to test it (given that error_category is 
>> both an abstract class and has a user-defined destructor)
> 
> Curious - I haven't dealt with constexpr much, but could you explain
> further why this is untestable yet is a useful/meaningful change to
> make?

I'll be happy to try.

In LWG Issue #2145, the C++ standard was changed to mark the constructor for 
std::error_category as "constexpr"
The change was done to match the current C++ standard. That's why it is 
useful/meaningful/desirable.

As for it being untestable - std::error_category is an abstract base class, 
which means it can't be instantiated, and it has a non-default virtual 
destructor, which means that classed that derived from it can't be constexpr.

If you read the LWG issue, there is a desire for static global variables 
(including thread-local statics) to be able to be initialized at compile time.

However, I don't see any good way to test that - (say) thread local statics 
being initialized at compile time; and even if I could test it, a failing test 
doesn't mean that libc++ is wrong - it might just mean that clang has decided 
not to construct the variable at compile time.

-- Marshall

Marshall Clow     Idio Software   <mailto:[email protected]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly 
moderated down to (-1, Flamebait).
        -- Yu Suzuki


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to