[LLVMbugs] [Bug 11961] New: Lookup template definition fails with clang while working with g++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 9 11:36:02 PST 2012


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

             Bug #: 11961
           Summary: Lookup template definition fails with clang while
                    working with g++
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sylvestre at debian.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This code is building fine with g++ but failing with clang++
----
template<typename Value_t>
void a(Value_t value)
{
    b(value);
}

template<typename Value_t>
void b(Value_t value)
{
}

void foo(int y)
{
    a(y);
}
-----


The error is:
---------
fparser.cc:6:5: error: call to function 'b' that is neither visible in the
      template definition nor found by argument-dependent lookup
    b(value);
    ^
fparser.cc:16:5: note: in instantiation of function template specialization
      'a<int>' requested here
    a(y);
    ^
fparser.cc:10:6: note: 'b' should be declared prior to the call site
void b(Value_t value)
     ^
1 error generated.
----------


Of course, adding 
template<typename Value_t> void b(Value_t value);
at the first line fixes the issue.

g++ accepts it.

Don't hesitate to tag it "won't fix" if you think that g++ is too relax.

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