Boost logo

Boost :

Subject: Re: [boost] Boost.Exception and constexpr
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-01-10 14:47:21


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.

> The error message is a QOI. Here it is the error with clang 3.1/3.2
>
> clang-darwin.compile.c++
> ../../../bin.v2/libs/thread/test/test_so.test/clang-darwin-3.1xl/debug/threading-multi/test_so.o
> ../example/test_so.cpp:20:12: error: non-type template argument is not a
> constant expression
> check< arr.at(10) > a;
> ^~~~~~~~~~
> ../example/test_so.cpp:7:30: note: subexpression not valid in a constant
> expression
>
> return i < n ? T() : throw 0;
> ^
> ../example/test_so.cpp:20:12: note: in call to '10->at()'
> check< arr.at(10) > a;
> ^

This looks better, thanks.


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