summaryrefslogtreecommitdiffstats
path: root/tests/initializer-list/explicit-ctor-diagnostic.slang
blob: 6ce65c016e0e4f0b31adff33cf96098f0d65ec5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):

struct ExplicitCtor
{
   int x;
   int y;
   __init(int x)
   {
      this.x = x;
      this.y = 0;
   }
  // compiler does not synthesize any ctors.
}

void test()
{
   // CHECK: error 39999: too many arguments to call (got 2, expected 1)
   ExplicitCtor e = {1, 2}; // error, no ctor matches initializer list.

   // CHECK: error 39999: not enough arguments to call (got 0, expected 1)
   ExplicitCtor e1 = {};
}