[LLVMbugs] [Bug 19344] New: constexpr constructor incorrectly rejected due to base class of non-literal type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 4 10:41:27 PDT 2014


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

            Bug ID: 19344
           Summary: constexpr constructor incorrectly rejected due to base
                    class of non-literal type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zilla at kayari.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

struct base
{
  constexpr base() { }
  ~base() { }
};

struct derived : base {
  constexpr derived() { }
};


a.cc:8:13: error: constexpr constructor never produces a constant expression
[-Winvalid-constexpr]
  constexpr derived() { }
            ^
a.cc:8:13: note: non-literal type 'base' cannot be used in a constant
expression
1 error generated.


I think clang is too strict here, I don't see where the standard requires all
base classes to have literal type for a constexpr constructor.

If derived::derived() is defined as defaulted the code is accepted, which is
inconsistent with the diagnostic because the base class is still non-literal.

-- 
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/20140404/24d57afa/attachment.html>


More information about the llvm-bugs mailing list