[PATCH] D148274: [clang] Fix overly aggressive lifetime checks for parenthesized aggregate initialization
Alan Zhao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 13 15:44:22 PDT 2023
ayzhao added inline comments.
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2130
+ "initializer|a related result|a parameter of CF audited function|a "
+ "structured binding|a member subobject}0 "
"%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
----------------
This was missing an entry for `EK_BINDING`, so I added one (otherwise, we hit an assertion failure).
================
Comment at: clang/test/SemaCXX/paren-list-agg-init.cpp:132
E e1(1);
- // expected-error at -1 {{no matching constructor for initialization of 'E'}}
+ // expected-error at -1 {{no matching constructor for initialization of 'F'}}
----------------
This turned out to be a bug in the original implementation. Currently, diagnostics are only emitted for class members if we fail a parenthesized aggregate init. However, this used to not be the case with value initialized members, which emits the diagnostic for the class itself. Refactoring `TryOrBuildParenListInit(...)` fixes this and makes things consistent.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148274/new/
https://reviews.llvm.org/D148274
More information about the cfe-commits
mailing list