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: unassignedclangb...@nondot.org
          Reporter: ztur...@google.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to