------- Additional Comments From maxim dot yegorushkin at gmail dot com 2005-04-23 10:55 ------- (In reply to comment #10) > Not working on this anymore. Andrew closed PR 11296 as a dup of this, but I'm > not 100% sure. This is the testcase, so that it can be tested and added to the > testsuite: > > ----------------------------------------------------- > namespace N { > template <class T> T foo (T) { return T (); } > template <class T> T bar (T t) { return foo (t); } > } > > struct S { S (int i = 0): i_ (i) { } int i_; }; > > namespace N { > /* template <> */ S foo (S) { return S (1); } > } > > int main () > { > return 1 == N::bar (S ()).i_; > } > ----------------------------------------------------- > (should return 0, but returns 1). >
Here is another test case that does compile time two-phase name check. Comeau online 4.3.3 BETA August 4, 2003 passes it, gcc 3.4.3 fails. For discussion please see http://groups-beta.google.com/group/comp.lang.c++. moderated/msg/c7227abb97603d15?hl=en namespace tpl_ { template<class T> char test(T); template<class T> struct check { static T const t; enum { value = 1 == sizeof(test(t)) }; }; double test(int); } bool const two_phase_lookup_supported = tpl_::check<int>::value; int compile_time_assert[two_phase_lookup_supported ? 1 : -1]; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2922