1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl
3f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redlstruct B1 {
4f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl  B1(int);
5f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl  B1(int, int);
6f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl};
7f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redlstruct D1 : B1 {
807b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  using B1::B1;
9f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl};
10f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian RedlD1 d1a(1), d1b(1, 1);
11f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl
12f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian RedlD1 fd1() { return 1; }
13f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl
14f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redlstruct B2 {
15f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl  explicit B2(int, int = 0, int = 0);
16f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl};
1785ea7aa961deac1d754f610af8062ae3f8b4e2a5Sebastian Redlstruct D2 : B2 { // expected-note 2 {{candidate constructor}}
1807b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  using B2::B2;
19f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl};
20f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian RedlD2 d2a(1), d2b(1, 1), d2c(1, 1, 1);
21f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl
22f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian RedlD2 fd2() { return 1; } // expected-error {{no viable conversion}}
23f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl
24f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redlstruct B3 {
25f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl  B3(void*); // expected-note {{inherited from here}}
26f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl};
2785ea7aa961deac1d754f610af8062ae3f8b4e2a5Sebastian Redlstruct D3 : B3 { // expected-note 2 {{candidate constructor}}
2807b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  using B3::B3; // expected-note {{candidate constructor (inherited)}}
29f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian Redl};
30f677ea3cc9598d9952ad7ffab5fb322ba4c5be31Sebastian RedlD3 fd3() { return 1; } // expected-error {{no viable conversion}}
31c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith
32c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smithtemplate<typename T> struct T1 : B1 {
3307b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  using B1::B1;
34c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith};
35c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smithtemplate<typename T> struct T2 : T1<T> {
3607b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  using T1<int>::T1;
37c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith};
38c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smithtemplate<typename T> struct T3 : T1<int> {
3907b0fdcee8d64222b274779d02851cc53d18e0dbRichard Smith  using T1<T>::T1;
40c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith};
41c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smithstruct U {
42c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith  friend T1<int>::T1(int);
43c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith  friend T1<int>::T1(int, int);
44c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith  friend T2<int>::T2(int);
45c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith  friend T2<int>::T2(int, int);
46c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith  friend T3<int>::T3(int);
47c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith  friend T3<int>::T3(int, int);
48c5a89a1cc2f168ad0a115c560b8de5f1c952d8c5Richard Smith};
494841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith
504841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smithstruct B4 {
514841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith  template<typename T> explicit B4(T, int = 0);
524841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith};
534841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smithtemplate<typename T> struct T4 : B4 {
544841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith  using B4::B4; // expected-note {{here}}
554841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith  template<typename U> T4(U);
564841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard Smith};
574841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard SmithT4<void> t4a = {0};
584841ca5f83bf970f910ac7d154cdd71d2a3cf481Richard SmithT4<void> t4b = {0, 0}; // expected-error {{chosen constructor is explicit}}
59