summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp
blob: 9c438d399b34839a9eb67bb0da79619ac5c3b368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %clang_cc1 -std=c++2a %s -verify

namespace class_with_ctor {
  struct A { // expected-note 6{{candidate}}
    A() = default; // expected-note 3{{candidate}}
    int x;
    int y;
  };
  A a = {1, 2}; // expected-error {{no matching constructor}}

  struct B {
    int x;
    int y;
  };
  B b1 = B(); // trigger declaration of implicit ctors
  B b2 = {1, 2}; // ok

  struct C : A {
    A a;
  };
  C c1 = {{}, {}}; // ok, call default ctor twice
  C c2 = {{1, 2}, {3, 4}}; // expected-error 2{{no matching constructor}}
}
OpenPOWER on IntegriCloud