https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89220
Bug ID: 89220
Summary: Inconsistent behaviour of class template type
deduction
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: matt at ookypooky dot com
Target Milestone: ---
Demonstrated by the following code:
template<typename T>
struct Foo
{
Foo (T) {}
auto operator () (int) { return 0; }
};
// this compiles
auto x = Foo(123)(0);
// this doesn't
auto y = (Foo(123))(0);
When compiled with "g++ -std=c++17". See here https://godbolt.org/z/Xrmf_8
Interestingly with "-std=c++1y" both x and y fail to compile, which is at least
consistent (even if I'm not sure it's correct...)