http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53573
--- Comment #12 from Keean Schupke <ke...@fry-it.com> 2012-06-05 11:14:00 UTC --- (In reply to comment #10) although -fpermissive allows the code to compile (in some circumstances) it does not in all, and it also produces incorrect output, for example: #include <iostream> char g(char x) { return x - 1; } template <typename T> T f(T t) { return g(t); } double g(double x) { return x; } main() { double x(f(1.0L)); std::cout << x << "\n"; } will output "0" instead of "1" choosing the wrong overloaded function. In the case below: #include <iostream> char g(char x) { return x - 1; } int g(int x) { return x + 1; } template <typename T> T f(T t) { return g(t); } double g(double x) { return x; } main() { double x(f(1.0L)); std::cout << x << "\n"; } compilation still fails with: test.cpp: In instantiation of ‘T f(T) [with T = long double]’: test.cpp:20:17: required from here test.cpp:12:12: error: call of overloaded ‘g(long double&)’ is ambiguous test.cpp:12:12: note: candidates are: test.cpp:3:6: note: char g(char) test.cpp:7:5: note: int g(int) even with -fpermissive > (In reply to comment #6) > > The suggested work around in the error message 'adding -fpermissive' to > > gcc-4.7.0 does not fix the problem as suggested by the error message. > > As Manu says, -fpermissive changes the error to a warning, allowing the code > to > compile. Please check it again. > > I'm going to close this, as I think G++ handles comment 1 correctly and both > EDG and Clang agree. > > I didn't check all your other examples in detail but I don't think they show > anything different: ADL doesn't find anything for built-in types such as int > or > char.