[llvm-bugs] [Bug 39362] New: const-default-constructible class has deleted constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 19 19:54:33 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39362

            Bug ID: 39362
           Summary: const-default-constructible class has deleted
                    constructor
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zturner at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

https://godbolt.org/z/s6Hjm0

struct A {
#ifdef DEFAULT
    A() = default; // error
#else
    A(){}; //ok
#endif
};

struct b {
    const A a;
};

struct c : b {
    c(){}
};

Per Richard Smith, this is a bug in the C++ standard, because
http://eel.is/c++draft/class.default.ctor#2.4 and
http://eel.is/c++draft/dcl.init#def:const-default-constructible conflict with
each other.  Clang conforms to the written behavior (constructor is deleted)
while other compilers conform to the intended behavior (class is
const-default-constructible).

Clang should conform to the intended behavior, even if the standard does not
(yet) reflect this.

This may or may not be related to Bug 33039.

-- 
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/20181020/0f2f0d6e/attachment.html>


More information about the llvm-bugs mailing list