[Bug c++/81486] New: Class template argument deduction fails with (), succeeds with {}
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 19 16:45:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486
Bug ID: 81486
Summary: Class template argument deduction fails with (),
succeeds with {}
Product: gcc
Version: 7.1.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: ---
Consider this example, simplified from
https://stackoverflow.com/q/45195890/2069064:
template <class T>
struct C {
C(T );
};
template <>
struct C<void> { };
C() -> C<void>;
int main() {
auto a = C{}; // ok
auto b = C(); // error
}
The two forms are equivalent in this context - a and b should both deduce to
C<void>. Yet, gcc accepts a and errors on b with: cannot deduce template
arguments for 'C' from ()
More information about the Gcc-bugs
mailing list