[LLVMbugs] [Bug 16008] New: constexpr function template specializations referenced from default initializers are not instantiated

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 14 19:03:22 PDT 2013


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

            Bug ID: 16008
           Summary: constexpr function template specializations referenced
                    from default initializers are not instantiated
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Example from DR1637:

  struct A {
    template <class T> constexpr void* f(T) { return nullptr; }
    A* ap = (A*)f(A());
    template <class ...T> constexpr A() {}
  };
  A *q = A().ap;

We do not instantiate a definition of A::f<A> here. Presumably this is because
we trigger the instantiation of the definition A::f<A> while parsing the
default initializer (before we've parsed the definition of A::f), and don't
make a note that we'll need to retry instantiation later if that instantiation
fails.

Reduced example:

  template<typename T> constexpr int f(T);          
  int k = f(0);
  template<typename T> constexpr int f(T) { return 0; }

-- 
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/20130515/2fdb2c5b/attachment.html>


More information about the llvm-bugs mailing list