This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81486] New: Class template argument deduction fails with (), succeeds with {}
- From: "barry.revzin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Jul 2017 16:45:50 +0000
- Subject: [Bug c++/81486] New: Class template argument deduction fails with (), succeeds with {}
- Auto-submitted: auto-generated
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 ()