[llvm-bugs] [Bug 51560] New: Defaulted consteval default constructor that performs no initialization is not rejected

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 20 08:01:24 PDT 2021


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

            Bug ID: 51560
           Summary: Defaulted consteval default constructor that performs
                    no initialization is not rejected
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: johelegp at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    johelegp at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

See https://godbolt.org/z/Gc4MTfdr7.
```C++
struct X{
  int i;
  consteval X() = default;
  // consteval X() {}
};
int main () {
    auto x = X();
    (void)x;
}
```

See also https://eel.is/c++draft/class.default.ctor#4, particularly
https://eel.is/c++draft/class.default.ctor#4.sentence-3:
> If that user-written default constructor would be ill-formed, the program is ill-formed.

-- 
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/20210820/9f8f06fe/attachment.html>


More information about the llvm-bugs mailing list