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]

c++/2922: two-phase name lookup not working



>Number:         2922
>Category:       c++
>Synopsis:       two-phase name lookup not working
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu May 24 02:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jens Maurer
>Release:        gcc version 3.0 20010521 (prerelease)
>Organization:
>Environment:
Linux 2.2.4 with glibc 2.2.3
>Description:
The program below is supposed to output
f(char)
f(int)
f(char)
f(char)

according to 14.6p9.

gcc (all of 2.95.3, pre-3.0, and 3.1 20010518) outputs
f(int)
f(int)
f(int)
f(char)
>How-To-Repeat:

// example (slightly adapted) from 14.6p9

#include <iostream>

void f(char)
{
  std::cout << "f(char)" << std::endl;
}

template<class T>
void g(T t)
{
  f(1);        // not dependent
  f(t);        // dependent
}

void f(int)
{
  std::cout << "f(int)" << std::endl;
}

int main()
{
  g(2);    // f(char) followed by f(int)
  g('a');  // two f(char)
}

>Fix:

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