107b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith// RUN: %clang_cc1 -std=c++11 -verify %s
207b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith// Per a core issue (no number yet), an ellipsis is always dropped.
307b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smithstruct A {
407b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  A(...); // expected-note {{here}}
5c4ef9485252c6a408acb70aac5a153dcd9d860c7Eli Friedman  A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 9{{here}} expected-note 2{{constructor cannot be inherited}}
607b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  A(int = 0, int = 0, ...); // expected-note {{here}}
74841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
84841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith  template<typename T> A(T, int = 0, ...); // expected-note 5{{here}}
94841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
10c4ef9485252c6a408acb70aac5a153dcd9d860c7Eli Friedman  template<typename T, int N> A(const T (&)[N]); // expected-note 2{{here}} expected-note {{constructor cannot be inherited}}
114841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith  template<typename T, int N> A(const T (&)[N], int = 0); // expected-note 2{{here}}
1207b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith};
1307b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
144841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smithstruct B : A { // expected-note 6{{candidate}}
15c4ef9485252c6a408acb70aac5a153dcd9d860c7Eli Friedman  using A::A; // expected-warning 4{{inheriting constructor does not inherit ellipsis}} expected-note 16{{candidate}} expected-note 3{{deleted constructor was inherited here}}
1607b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith};
1707b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
184841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smithstruct C {} c;
194841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
2007b0fdcee8d64222b274779d02851cc53d18e0dbRichard SmithB b0{};
21c4ef9485252c6a408acb70aac5a153dcd9d860c7Eli Friedman// expected-error@-1 {{call to implicitly-deleted default constructor of 'B'}}
224841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith// expected-note@-8 {{default constructor of 'B' is implicitly deleted because base class 'A' has multiple default constructors}}
2307b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
2407b0fdcee8d64222b274779d02851cc53d18e0dbRichard SmithB b1{1};
25c4ef9485252c6a408acb70aac5a153dcd9d860c7Eli Friedman// expected-error@-1 {{call to deleted constructor of 'B'}}
2607b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
2707b0fdcee8d64222b274779d02851cc53d18e0dbRichard SmithB b2{1,2};
28c4ef9485252c6a408acb70aac5a153dcd9d860c7Eli Friedman// expected-error@-1 {{call to deleted constructor of 'B'}}
2907b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
3007b0fdcee8d64222b274779d02851cc53d18e0dbRichard SmithB b3{1,2,3};
3107b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith// ok
3207b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
3307b0fdcee8d64222b274779d02851cc53d18e0dbRichard SmithB b4{1,2,3,4};
3407b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith// ok
3507b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith
3607b0fdcee8d64222b274779d02851cc53d18e0dbRichard SmithB b5{1,2,3,4,5};
3707b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith// expected-error@-1 {{no matching constructor for initialization of 'B'}}
384841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
394841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard SmithB b6{c};
404841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith// ok
414841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
424841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard SmithB b7{c,0};
434841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith// ok
444841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
454841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard SmithB b8{c,0,1};
464841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith// expected-error@-1 {{no matching constructor}}
474841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
484841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard SmithB b9{"foo"};
494841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith// FIXME: explain why the inheriting constructor was deleted
504841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith// expected-error@-2 {{call to deleted constructor of 'B'}}
51987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith
52987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smithnamespace PR15755 {
53987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  struct X {
54987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith    template<typename...Ts> X(int, Ts...);
55987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  };
56987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  struct Y : X {
57987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith    using X::X;
58987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  };
59987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  struct Z : Y {
60987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith    using Y::Y;
61987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  };
62987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith  Z z(0);
63987c03085558277a5fe8cef8e1b628cabcc626dcRichard Smith}
64