https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77302
Bug ID: 77302 Summary: partial specialization marked as ambiguous Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rlangendam at gmail dot com Target Milestone: --- Created attachment 39475 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39475&action=edit C++ source file that wrongfully fails to compile Compiling the attached C++ source file with g++ 6.1.1 20160802, as described below, yields an ambiguity error wrongfully. After all, out of the two mentioned partial specializations, the former is more specialized than the latter. FYI, the file compiles fine using clang++ 3.8, using the same options. $ g++ -std=c++11 -c test.cpp test.cpp:15:64: error: ambiguous template instantiation for ‘struct Test<std::integral_constant<int, 0> >’ static_assert(std::is_same<Test<std::integral_constant<int, 0>>::type, void>::value, ""); ^~ test.cpp:6:8: note: candidates are: template<class T> struct Test<std::integral_constant<T, 0> > [with T = int] struct Test<std::integral_constant<T, 0>> { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.cpp:11:8: note: template<class T, T V> struct Test<std::integral_constant<T, V> > [with T = int; T V = 0] struct Test<std::integral_constant<T, V>> : ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.cpp:15:28: error: incomplete type ‘Test<std::integral_constant<int, 0> >’ used in nested name specifier static_assert(std::is_same<Test<std::integral_constant<int, 0>>::type, void>::value, ""); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.cpp:15:28: error: incomplete type ‘Test<std::integral_constant<int, 0> >’ used in nested name specifier test.cpp:15:76: error: template argument 1 is invalid static_assert(std::is_same<Test<std::integral_constant<int, 0>>::type, void>::value, "");