p1.cpp revision 987c03085558277a5fe8cef8e1b628cabcc626dc
1// RUN: %clang_cc1 -std=c++11 -verify %s
2// Per a core issue (no number yet), an ellipsis is always dropped.
3struct A {
4  A(...); // expected-note {{here}}
5  A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 9{{here}}
6  A(int = 0, int = 0, ...); // expected-note {{here}}
7
8  template<typename T> A(T, int = 0, ...); // expected-note 5{{here}}
9
10  template<typename T, int N> A(const T (&)[N]); // expected-note 2{{here}}
11  template<typename T, int N> A(const T (&)[N], int = 0); // expected-note 2{{here}}
12};
13
14struct B : A { // expected-note 6{{candidate}}
15  using A::A; // expected-warning 4{{inheriting constructor does not inherit ellipsis}} expected-note 16{{candidate}} expected-note 3{{deleted}}
16};
17
18struct C {} c;
19
20B b0{};
21// expected-error@-1 {{call to implicitly-deleted default constructor}}
22// expected-note@-8 {{default constructor of 'B' is implicitly deleted because base class 'A' has multiple default constructors}}
23
24B b1{1};
25// FIXME: explain why the inheriting constructor was deleted
26// expected-error@-2 {{call to implicitly-deleted function of 'B'}}
27
28B b2{1,2};
29// expected-error@-1 {{call to implicitly-deleted function of 'B'}}
30
31B b3{1,2,3};
32// ok
33
34B b4{1,2,3,4};
35// ok
36
37B b5{1,2,3,4,5};
38// expected-error@-1 {{no matching constructor for initialization of 'B'}}
39
40B b6{c};
41// ok
42
43B b7{c,0};
44// ok
45
46B b8{c,0,1};
47// expected-error@-1 {{no matching constructor}}
48
49B b9{"foo"};
50// FIXME: explain why the inheriting constructor was deleted
51// expected-error@-2 {{call to deleted constructor of 'B'}}
52
53namespace PR15755 {
54  struct X {
55    template<typename...Ts> X(int, Ts...);
56  };
57  struct Y : X {
58    using X::X;
59  };
60  struct Z : Y {
61    using Y::Y;
62  };
63  Z z(0);
64}
65