[Bug c++/86678] constexpr evaluation incorrectly diagnoses unevaluated call to non-constexpr function
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 26 10:40:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86678
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-07-26
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
void fail();
template <class T>
constexpr int foo() {
if (sizeof(T))
return 1;
if (1)
fail();
}
constexpr int V = foo<int>();
a.cc:11:27: error: 'constexpr int foo() [with T = int]' called in a constant
expression
constexpr int V = foo<int>();
~~~~~~~~^~
a.cc:4:15: note: 'constexpr int foo() [with T = int]' is not usable as a
'constexpr' function because:
constexpr int foo() {
^~~
a.cc:8:11: error: call to non-'constexpr' function 'void fail()'
fail();
~~~~^~
More information about the Gcc-bugs
mailing list