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

             Bug #: 12005
           Summary: explicit instantiation doesn't emit variable is
                    non-ODR-used earlier
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified


This testcase demonstrates a problem:

  void f(int);

  template <typename T>
  struct A {
    void g() { f(k); }
    static const int k;
  };

  template <typename T> const int A<T>::k = -1;

  template struct A<int>;

where we fail to emit 'A<int>::k' because it was used -- but not ODR-used --
earlier in the body of g.

nlewycky@ducttape:~$ g++ x.cc -c; nm x.o
                 U _Z1fi
0000000000000000 W _ZN1AIiE1gEv
0000000000000000 V _ZN1AIiE1kE
                 U __gxx_personality_v0
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang++ x.cc -c; nm x.o
                 U _Z1fi
0000000000000000 W _ZN1AIiE1gEv

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to