This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Add support for reporting multiple errors during initialization
Needs ReviewPublic

Authored by nullptr.cpp on Dec 31 2020, 1:42 AM.
This revision needs review, but there are no reviewers specified.



During the initialization process, more than one error may be encountered, but
Clang reports only one of them. This patch makes Clang report all errors.

Depends on D93962

Diff Detail

Event Timeline

nullptr.cpp requested review of this revision.Dec 31 2020, 1:42 AM
nullptr.cpp created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 31 2020, 1:42 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Quuxplusone added inline comments.

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.

43 (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?