https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94038
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Compiling with -Wall causes |[8/9/10 Regression]
|function template body to |Compiling with -Wall causes
|get needlessly instantiated |function template body to
| |get needlessly instantiated
Known to work| |5.5.0
Known to fail| |10.0, 6.4.0, 7.4.0, 8.3.0,
| |9.3.0
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot
gnu.org
Target Milestone|--- |10.0
Last reconfirmed| |2020-05-04
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.
However, it looks like GCC 5.2-5.5 successfully compile the added testcase
g++.dg/warn/pr94038.C (with -O and -Wall), buh GCC 5.1, 6.1 and later do not,
so I am leaving this PR open and marking it as a 8/9/10 regression.
Here's the exact testcase that exhibits a regression relative to gcc 5.5:
$ cat testcase.C
template<typename T>
constexpr int
foo()
{
static_assert(T(1) == 0, "");
return 0;
}
template<typename T>
constexpr int
bar()
{
return foo<T>();
}
constexpr int
baz(int a)
{
return a;
}
static_assert(decltype(baz(bar<int>())){} == 0, "");
$ g++-10 -std=c++11 -O -Wall testcase.C
testcase.C: In instantiation of ‘constexpr int foo() [with T = int]’:
testcase.C:17:16: required from ‘constexpr int bar() [with T = int]’
testcase.C:26:36: required from here
testcase.C:9:22: error: static assertion failed
9 | static_assert(T(1) == 0, "");
| ~~~~~^~~~