[Bug c++/71093] New: use of pseudo-destructor accepted in constant expression
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 12 23:09:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71093
Bug ID: 71093
Summary: use of pseudo-destructor accepted in constant
expression
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
Among the list of expressions that are not core constant expressions and thus
are not usable in constexpr contexts is the call to a pseudo-destructor such as
in the following (invalid) test case. The test case is silently accepted by
all versions of GCC when it should be rejected.
$ cat xx.cpp && gcc -S -Wall -Wextra -Wpedantic -o/dev/null xx.cpp
constexpr int f (const int *p)
{
typedef int T;
p->~T ();
return *p;
}
constexpr int i = 0;
constexpr int j = f (&i);
More information about the Gcc-bugs
mailing list