This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71035] New: GNU does not give error on declaration of non literal type in template function
- From: "Judy.Ward at intel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 May 2016 22:11:48 +0000
- Subject: [Bug c++/71035] New: GNU does not give error on declaration of non literal type in template function
- Auto-submitted: auto-generated
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;
}