[LLVMbugs] [Bug 19095] New: dejagnu test fails to compile with clang g++.old-deja/g++.pt/friend10.C

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 10 02:05:03 PDT 2014


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

            Bug ID: 19095
           Summary: dejagnu test fails to compile with clang
                    g++.old-deja/g++.pt/friend10.C
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sardask01 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

template <class T>
void f(T);

template <class U>
class C
{ 
  template <class T>
  friend void f(T)
  {
     C<U> c;
     c.i = 3;
  }

  public :

     void g()
     {
       f(3.0);
     }
    int i;
};

int main ()
{
  f(7);
  C<double> c;
  c.g();
}


This Test Case compiles with g++. Fails with clang, linker error - unable to
find definition of function f() with following error :

Opensource/llvm/build/bin/clang friend10.C 

/tmp/friend10-f7127e.o: In function `main':
friend10.C:(.text+0x16): undefined reference to `void f<int>(int)'
/tmp/friend10-f7127e.o: In function `C<double>::g()':
friend10.C:(.text._ZN1CIdE1gEv[_ZN1CIdE1gEv]+0x1b): undefined reference to
`void f<double>(double)'
clang-3.5: error: linker command failed with exit code 1 (use -v to see
invocation)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140310/bc256b86/attachment.html>


More information about the llvm-bugs mailing list