http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58352
Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler@googlemail. | |com --- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> --- The code example has undefined behaviour and moving your specialization to the top is required to make it work. You hit [temp.dep.candidate] p1: "For a function call where the postfix-expression is a dependent name, the candidate functions are found using the usual lookup rules (3.4.1, 3.4.2) except that: — For the part of the lookup using unqualified name lookup (3.4.1), only function declarations from the template definition context are found. [..] If the call would be ill-formed or would find a better match had the lookup within the associated namespaces considered all the function declarations with external linkage introduced in those namespaces in all translation units, not just considering those declarations found in the template definition and template instantiation contexts, then the program has undefined behavior."