The code example below compiles successfully under Microsoft Visual Studio 2005 SP1.
Minimal steps to reproduce: ------------------------------------------------- template<typename T> void foo(T &) {} int main() { struct A { int m; }; A a; foo(a); return 0; } ----------------------------------------- [EMAIL PROTECTED]:~$ g++ test.cpp test.cpp: In function 'int main()': test.cpp:11: error: no matching function for call to 'foo(main()::A&)' [EMAIL PROTECTED]:~$ g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) -- Summary: g++ fails to compile local class which is passed to template function Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: deathbaba at gmail dot com GCC host triplet: Linux version 2.6.18-4-k7 (Debian 2.6.18.dfsg.1-12) ([EMAIL PROTECTED] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35087