https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94922
Bug ID: 94922
Summary: Functional cast from base class to derived class
incorrectly accepted with -std=c++2a
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
$ cat testcase.C
struct base {};
struct derived : base {};
template <typename T, typename R, typename = decltype(T(R()))>
void foo();
void
bar()
{
foo<derived, base>();
}
$ g++-10 -std=c++2a testcase.C
$ g++-10 -std=c++17 testcase.C
testcase.C: In function ‘void bar()’:
testcase.C:10:22: error: no matching function for call to ‘foo<derived,
base>()’
13 | foo<derived, base>();
| ^
...