c++/2437: template name binding problem
kenny.simpson@gs.com
kenny.simpson@gs.com
Fri Mar 30 07:56:00 GMT 2001
>Number: 2437
>Category: c++
>Synopsis: template name binding problem
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Mar 30 07:56:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Kenny Simpson
>Release: gcc version 3.0 20010327 (prerelease)
>Organization:
>Environment:
online compiler 2001-03-30
>Description:
Names that do not depend on a template arguments should be bound at the point of definition, however, gcc seems to be binding names at a later time.
This is a modified example from Stroustrup C.13.8:
>How-To-Repeat:
Compile this -O3 to assembly, observe that "g(int)" is emmitted, not "g(double)".
inline void g(double) { __asm(" g(double) ");}
template <class T> struct X
{
void f() { g(2);} // should call g(double)
};
inline void g(int) { __asm(" g(int) ");}
int main()
{
X<int>().f(); // should call g(double), but calls g(int)
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list