You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<source>:4:32: error: call to consteval function 'S::func' is not a constant expression
4 | static bool func2() { return func(); }
| ^
<source>:4:32: note: undefined function 'func' cannot be used in a constant expression
<source>:6:25: note: declared here
6 | static consteval bool func() { return true; }
| ^
1 error generated.
The note is somewhat confusing IMO, since the consteval function is in fact defined. Something like consteval function that has not yet been defined cannot be used would be better, and an additional note consider moving the definition of `func` above `func2` would be really great.
The text was updated successfully, but these errors were encountered:
but once we are in the body of member function we are in a complete class context and so then we should have a definition. All the issues I mentioned are various versions of that.
Is this why the following code fails with clang + libstdc++?
#include<string>constexprauto z = std::string("", 0).size();
There's no consteval function here, but we get a similar undefined function '_M_construct<const char *>' cannot be used in a constant expression diagnostic about a member function defined outside the class body.
results in the diagnostic
The note is somewhat confusing IMO, since the
consteval
function is in fact defined. Something likeconsteval function that has not yet been defined cannot be used
would be better, and an additional noteconsider moving the definition of `func` above `func2`
would be really great.The text was updated successfully, but these errors were encountered: