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

            Bug ID: 16448
           Summary: DR1358: if an instantiated constexpr function template
                    doesn't satisfy the constexpr requirements, we should
                    not allow it to be called in a constant expression
           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:

struct S { virtual int f(); };
template<typename T> struct X : T {
  constexpr X() {}
  double d = 0.0;
  constexpr int f() { return sizeof(T); }
};
constexpr X<X<S> > xxs;
constexpr const X<S> *p = &xxs;
static_assert(p->f() == sizeof(X<S>), "");

Clang accepts this but the static_assert fails, because the call is made
non-virtually. Per core issue DR1358, evaluation of a call to a constexpr
constructor temploid whose specialization does not obey the constexpr rules is
supposed to fail.

-- 
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