This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8876: wrong template instantiation


>Number:         8876
>Category:       c++
>Synopsis:       wrong template instantiation
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 08 15:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Benoit Sevigny
>Release:        gcc version 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Window XP
>Description:
When calling a static function of an explicitely instantiated template structure enclosed in another template structure, the wrong template is being instantiated.
>How-To-Repeat:
compile and run the attached code.

It should print (as with Visual C++ 6.0):

calling function<3> -> in function<3>: l = 1, r = 2
calling function<3> -> in function<3>: l = 2, r = 1
calling function<100> -> in function<100>: l = 1, r = 2
calling function<100> -> in function<100>: l = 2, r = 1

However, if it prints:

calling function<3> -> in function<1>: l = 1, r = 2
calling function<3> -> in function<2>: l = 2, r = 1
calling function<100> -> in function<1>: l = 1, r = 2
calling function<100> -> in function<2>: l = 2, r = 1

Then the wrong function template it being instantiated.
>Fix:
No fix known
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]