When the folliwng program is compiled: 

template <typename T> void f(T x) {}
int main()
{
        class A{} a;
        f(a);
}

g++ syas:

test.cc: In function 'int main()':
test.cc:5: error: no matching function for call to 'f(main()::A&)'

but if you move the class definition outside the main function, the error
disappears.


-- 
           Summary: instantiation of template functions for locally defined
                    classes
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mmirzaza at cs dot uwaterloo dot ca


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27061

Reply via email to