[llvm-bugs] [Bug 50344] clang 12.0.0 ignores copy constructor and fails to compile seemingly correct code

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 17 02:15:49 PDT 2021


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

Fedor Kazmin <f.kazmin at corp.mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Fedor Kazmin <f.kazmin at corp.mail.ru> ---
Sorry, I can hardly understand the phrase "A class with a deleted move
constructor has a move constructor". If a move constructor is deleted it is not
where. If it is not where what does a class have?
I always thought a compiler can implicitly create a move constructor for a
class and explicitly deleting it is the way to ensure it does not exist.

Thinking this way, "The compiler doesn't check whether a constructor is deleted
until after it decides which constructor to use" is exactly the thing looking
like a bug. 

Moreover, clang 12 apple version compiles the code in question silently!

f.kazmin at f-kazmin target % clang++ -v
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

f.kazmin at f-kazmin build % clang++ --std=c++17 movector.cpp
f.kazmin at f-kazmin build % echo $?
0

The "--std=c++17" parameter changes nothing for linux version so it was omitted
in previous input to strip the example.

I recon one of the clang versions misbehaves and I guess it is linux version
because gcc 10.3.0 compiles the code as well.

-- 
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/20210517/b9d05afb/attachment.html>


More information about the llvm-bugs mailing list