[Bug c++/63924] Constexpr constructible expression "is not constexpr" when used in a template non-type argument

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 19 22:25:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63924

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Nikos from comment #5)
> I am sorry, it is missing from the original test case, but
> 
>   noop<
>     require_costexpr< size0(ar) >,
>     require_constexp< size1(ar) >
>   >();
> 
> compiles fine.

Yes, because ar is a constexpr variable.  The parameter 't' of size3 is not a
constexpr variable.  When compiling a constexpr function, the parameters are
not constant; only in a call to that function are the parameters (sometimes)
replaced by constants.  Remember that a constexpr function is still a normal
function, and can be called with non-constant arguments.

I agree that the compiler should treat the implicit trivial constructor the
same as the user-defined constructor.



More information about the Gcc-bugs mailing list