https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89062

            Bug ID: 89062
           Summary: class template argument deduction failure with
                    parentheses
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Reduced from StackOverflow https://stackoverflow.com/q/54369677/2069064:

template<class T>
struct Foo {
    Foo(T) {}
};

template<class T>
struct Bar {
     Bar(T) {};
};

Foo foo(Bar{1});

This fails with:

<source>:11:9: error: 'auto' parameter not permitted in this context
 Foo foo(Bar{1});
         ^~~
Compiler returned: 1

Every other alternative is fine:

Foo foo(Bar(1)); // ok
Foo foo{Bar{1}}; // ok
Foo foo{Bar(1)}; // ok
Foo foo(Bar<int>(1)); // ok
Foo foo(Bar<int>{1}); // ok
Foo<Bar<int>> foo(Bar{1}); // ok

Reply via email to