The following code compiles with GCC 7.3.0 and earlier, but errors with GCC 8.1.0 and trunk. template<class T, T... S> struct String_template {}; template<class C, C... S> constexpr String_template<C, S...> operator""_template() { return String_template<C, S...> {}; } template<class prefix = decltype("0x"_template), class T> int hex(T v) { return 1; } template<int v> void tt2() { auto h2 = hex<decltype("0x"_template)>(1); auto h = hex(2); } int main() { auto h = hex(2); return h; } <source>: In function 'void tt2()': <source>:14:19: error: no matching function for call to 'hex(int)' auto h = hex(2); ^ <source>:9:5: note: candidate: 'template<class prefix, class T> int hex(T)' int hex(T v) { return 1; } ^~~ <source>:9:5: note: template argument deduction/substitution failed: The error is only triggered by hex(2). The error may be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85731
I'm not sure if this is valid, but it started to be rejected with with r258039 PR c++/84489 - dependent default template argument * pt.c (type_unification_real): Handle early substitution failure.
Author: jason Date: Thu May 24 14:27:10 2018 New Revision: 260672 URL: https://gcc.gnu.org/viewcvs?rev=260672&root=gcc&view=rev Log: PR c++/85864 - literal template and default template arg. * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK. Added: trunk/gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c
Author: jason Date: Thu May 24 14:29:05 2018 New Revision: 260674 URL: https://gcc.gnu.org/viewcvs?rev=260674&root=gcc&view=rev Log: PR c++/85864 - literal template and default template arg. * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/pt.c
Fixed.