https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71035
Bug ID: 71035
Summary: GNU does not give error on declaration of non literal
type in template function
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Judy.Ward at intel dot com
Target Milestone: ---
Both EDG and Clang give an error on the code below.
GNU only gives an error if call() is not a template function (see -DERROR
below) or if call() is used in a way that requires it to be constexpr (i.e. in
a static_assert).
I think this should be an error.
struct C
{
C(); // constructor is not declared constexpr
};
#ifdef ERROR
#else
template <class T>
#endif
constexpr void call()
{
C c;
}
int main() {
#ifdef ERROR
call();
#else
call<int>();
#endif
return 0;
}