[llvm-bugs] [Bug 45087] New: implicit copy construction of recursively empty class object rejected in constant expression evaluation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 3 06:07:42 PST 2020


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

            Bug ID: 45087
           Summary: implicit copy construction of recursively empty class
                    object rejected in constant expression evaluation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ed at catmur.co.uk
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

struct A {
    struct B {} b;
    // constexpr A(A const& a) : b{a.b} {} // #1
    // constexpr A() {} // #2
} a;
constexpr A aa = a;

rejected with error: constexpr variable 'aa' must be initialized by a constant
expression

But the implicitly-defined [class.copy.ctor]/14 is equivalent to #1, and
uncommenting #1 (and #2) accepts.

gcc accepts; MSVC rejects.

-- 
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/20200303/c728cacf/attachment.html>


More information about the llvm-bugs mailing list