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

Reply via email to