[LLVMbugs] [Bug 19923] New: Member functions of class templates not instantiated despite [[gnu::used]]

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 2 11:41:27 PDT 2014


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

            Bug ID: 19923
           Summary: Member functions of class templates not instantiated
                    despite [[gnu::used]]
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm-bugs at quasiparticle.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In a class template, g++ instantiates member functions marked with
[[gnu::used]] even when those functions are used nowhere in the program. clang
does not. This causes code to compile that doesn't compile on g++, e.g.

#include <type_traits>

template<class I>
class X {
  [[gnu::used]]
  static void check() {
    static_assert(std::is_enum<I>::value, "");
  }
};

X<int> x;

-- 
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/20140602/8d0bfe12/attachment.html>


More information about the llvm-bugs mailing list