Template bug

Mark Mitchell mmitchell@usa.net
Tue Dec 9 16:41:00 GMT 1997


>>>>> "Konstantin" == Konstantin Baumann <kostab@ESCHER.UNI-MUENSTER.DE> writes:

    Konstantin> template<unsigned long SIZE> struct Array { };

    Konstantin> template<unsigned long SIZE> Array<SIZE + 1>
    Konstantin> test_error(const Array<SIZE>& a) { Array<SIZE + 1>
    Konstantin> result; return(result); }

    Konstantin> int main(int argc, char* argv[]) { Array<2> a;

    Konstantin>     test_ok(a); test_error(a); // <<< MARKED LINE!

    Konstantin>     return(0); }

I've figured out what's happening here, but not how to fix it.  The
C++ standard says that the signature of a function template consists
of its function signature, its return type, and its template parameter
list.  And, the signature of a function template specialization
consists of the signature of the function template and the actual
template arguments.  So, we (sort-of correctly) try to put Array<SIZE
+ 1> into the mangled name, only that we don't have a way of mangling
that.  Jason, do we have a conceptual bug in the name-mangling scheme,
or should I just try to concoct a way of mangling arbitrary
expressions and have build_overload_int do that in cases like these?

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu




More information about the Gcc-bugs mailing list