https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878
Bug ID: 96878 Summary: Failed class template argument deduction in unevaluated, parenthesized context Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbergman at redhat dot com Target Milestone: --- At least with recent GCC 11 trunk and with gcc-c++-10.2.1-1.fc32.x86_64: > $ cat test.cc > template<int N> struct S { S(char const (& s)[N]); }; > auto n = sizeof (S("")); > $ g++ -std=c++17 -fsyntax-only test.cc > test.cc:2:18: error: missing template arguments after ‘S<...auto...>’ > 2 | auto n = sizeof (S("")); > | ^ > test.cc:1:24: note: ‘template<int N> struct S’ declared here > 1 | template<int N> struct S { S(char const (& s)[N]); }; > | ^ If you change `sizeof (S(""))` to `sizeof S("")`, compilation succeeds.