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

Reply via email to