[LLVMbugs] [Bug 8071] New: Lookup of dependent function name declared in instantiation context fails

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 3 03:41:47 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8071

           Summary: Lookup of dependent function name declared in
                    instantiation context fails
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following code fails to compile with Clang built from trunk r112953:

namespace ns {
  template <typename T>
  void function_template(const T &val) {
    foo(val);
  }
}

void foo(int x) { }

void test() {
  ns::function_template(42);
}

clang++ -c /tmp/a.cc
/tmp/a.cc:4:5: error: use of undeclared identifier 'foo'
    foo(val);
    ^
/tmp/a.cc:11:3: note: in instantiation of function template specialization
      'ns::function_template<int>' requested here
  ns::function_template(42);
  ^
1 error generated.


This compiles with GCC. I'm not a standards expert, but since foo is a
type-dependent name, shouldn't it be looked up in the context of the template
instantiation, or something to that effect?

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list