File tree Expand file tree Collapse file tree 2 files changed +31
-14
lines changed
test/CXX/dcl.decl/dcl.init/dcl.init.general Expand file tree Collapse file tree 2 files changed +31
-14
lines changed Original file line number Diff line number Diff line change @@ -6714,7 +6714,8 @@ void InitializationSequence::InitializeFrom(Sema &S,
67146714 OverloadCandidateSet::iterator Best;
67156715 OverloadingResult OR = getFailedCandidateSet ().BestViableFunction (
67166716 S, Kind.getLocation (), Best);
6717- if (OR != OverloadingResult::OR_Deleted) {
6717+ if (OR != OverloadingResult::OR_Deleted &&
6718+ Kind.getKind () == InitializationKind::IK_Direct) {
67186719 // C++20 [dcl.init] 17.6.2.2:
67196720 // - Otherwise, if no constructor is viable, the destination type is
67206721 // an
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
22
3- // If the initializer is (), the object is value-initialized.
4-
5- // expected-no-diagnostics
63namespace GH69890 {
7- struct A {
8- constexpr A () {}
9- int x;
10- };
4+ // If the initializer is (), the object is value-initialized.
5+ struct A {
6+ constexpr A () {}
7+ int x;
8+ };
9+
10+ struct B : A {
11+ int y;
12+ };
13+
14+ static_assert (B().x == 0 );
15+ static_assert (B().y == 0 );
16+ } // namespace GH69890
17+
18+ namespace P0960R3 {
19+ struct A { // expected-note 9 {{candidate constructor}}
20+ int i;
21+ operator int () volatile;
22+ };
23+
24+ volatile A va;
25+ A a = va; // expected-error {{no matching constructor for initialization of 'A'}}
1126
12- struct B : A {
13- int y;
14- };
27+ A f () {
28+ return va; // expected-error {{no matching constructor for initialization of 'A'}}
29+ }
1530
16- static_assert (B().x == 0 );
17- static_assert (B().y == 0 );
18- }
31+ int g (A); // expected-note {{passing argument to parameter here}}
32+ int g (auto &&);
33+ int i = g(va); // expected-error {{no matching constructor for initialization of 'A'}}
34+ } // namespace P0960R3
You can’t perform that action at this time.
0 commit comments