Boost logo

Boost :

Subject: Re: [boost] Boost.Exception and constexpr
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-01-10 16:10:17


Le 10/01/13 20:47, Andrey Semashev a écrit :
> On Thu, Jan 10, 2013 at 11:31 PM, Vicente J. Botet Escriba
> <vicente.botet_at_[hidden]> wrote:
>> Le 10/01/13 20:12, Andrey Semashev a écrit :
>>
>>> On Thu, Jan 10, 2013 at 10:51 PM, Vicente J. Botet Escriba
>>> <vicente.botet_at_[hidden]> wrote:
>>>> Le 10/01/13 19:13, Andrey Semashev a écrit :
>>> The constructor doesn't make any difference, it's the at() method body
>>> that causes the error.
>> Yes it does.
> The implicit default constructor is constexpr when possible, so
> defining it constexpr explicitly doesn't make any difference.
>
Maybe you are right. I said that because clang was requiring it but
gcc-4.7 accept the default constructor as a constexpr.

clang-darwin.compile.c++
../../../bin.v2/libs/thread/test/test_so.test/clang-darwin-3.2xl/debug/threading-multi/test_so.o
../example/test_so.cpp:19:31: error: default initialization of an object
of const type 'const array<int, 5>' requires a user-provided default
constructor
     constexpr array< int, 5 > arr;
                               ^
../example/test_so.cpp:21:12: error: use of undeclared identifier 'a'
     return a.get();

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk