[LLVMbugs] [Bug 16448] New: 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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 25 11:25:20 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130625/8d12cdb7/attachment.html>


More information about the llvm-bugs mailing list