[LLVMbugs] [Bug 6553] New: Difference between clang and g++ in lookup of methods of template base classes
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Mon Mar  8 20:45:54 PST 2010
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=6553
           Summary: Difference between clang and g++ in lookup of methods
                    of template base classes
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthias at gamezock.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
            Blocks: 6023
The folowing code compiles fine with g++, clang++ wants fooNum to be qualified
(Foo<T>::fooNum). I'm not sure which compiler handles this case correctly, but
this affects boost (a similar construct is used in the OpenSSL backend of the
Boost ASIO library).
template <typename T>
struct Foo {
  void fooNum(int newNum) {}
};
template <typename T>
struct Bar : public Foo<T> {
  Bar(int i) { 
    fooNum(getNum());
  }
  int getNum() {return 23;}
};
int main() {
  Bar<void> bar(42);
  return 0;
}
g++ does find the fooNum method, as it considers getNum dependent on T, so it
also looks in Foo. Just calling 'fooNum(23);' fails with both compilers.
-- 
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