Issue 154577
Summary Cannot delete constructor with nullptr_t, parses as data member instead
Labels new issue
Assignees
Reporter dascandy
    The following code

    struct C {
 C(nullptr_t) = delete;
    };

results in the compile error 

 <source>:2:7: error: field has incomplete type 'C'
        2 | C(nullptr_t) = delete;
          |       ^
    <source>:1:8: note: definition of 'C' is not complete until the closing '}'
        1 | struct C {
          |        ^

Expected behavior is that the construction from nullptr_t is marked as a deleted function, so users get clearer error messages. Tested on LLVM/Clang trunk as per 20-08-2025 on Godbolt:

https://godbolt.org/z/xvn8ozva1

Changing the function to `C(decltype(nullptr)) = delete;` works as a workaround.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to