[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    c++/2437: template name binding problem
From:       kenny.simpson () gs ! com
Date:       2001-03-30 15:46:39
[Download RAW message or body]


> 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:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic