[PATCH] D93955: [Sema] Add support for reporting multiple errors during initialization

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 1 08:45:43 PST 2021


Quuxplusone added inline comments.


================
Comment at: clang/test/SemaCXX/diagnostic-initialization.cpp:7
+template <class _E>
+class initializer_list {
+  const _E *__begin_;
----------------
Looking at other places like `clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp`, I think you don't need quite so much code here. However, also, I'm amazed that people are cutting-and-pasting `class initializer_list` between test cases; shouldn't it just be in a support header somewhere? (My second sentence is likely out of scope for this PR, I know.)
Anyway, my next comment shows that you don't need `initializer_list` at all, so both parts of this comment are moot.


================
Comment at: clang/test/SemaCXX/diagnostic-initialization.cpp:43
+// expected-error at -1 {{call to deleted constructor of 'A'}}
+// expected-error at -2 {{chosen constructor is explicit in copy-initialization}}
----------------
https://godbolt.org/z/aMa4e6 (showing the old behavior, and also showing that you don't need `class initializer_list` to trigger it)

IIUC, the changed behavior here is that old-Clang complained only that the chosen ctor was deleted; new-Clang complains that the chosen ctor is deleted //and// that the chosen ctor is explicit?
IMHO this is not actually an improvement, at least not in this particular case. However, it's not //significantly worse//, and also it brings Clang (back) into line with GCC and ICC in terms of outputting multiple complaints about the same problem, so I wouldn't say that this patch is //wrong//...
Still, could you find an example where this patch clearly //improves// Clang's behavior?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93955/new/

https://reviews.llvm.org/D93955



More information about the cfe-commits mailing list