• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
2 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
3 // RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
4 
5 #if __cplusplus < 201103L
6 // expected-no-diagnostics
7 #endif
8 
9 namespace std {
10   __extension__ typedef __SIZE_TYPE__ size_t;
11 
12   template<typename T> struct initializer_list {
13     const T *p; size_t n;
14     initializer_list(const T *p, size_t n);
15   };
16 }
17 
18 namespace dr990 { // dr990: 3.5
19 #if __cplusplus >= 201103L
20   struct A { // expected-note 2{{candidate}}
21     A(std::initializer_list<int>); // expected-note {{candidate}}
22   };
23   struct B {
24     A a;
25   };
26   B b1 { };
27   B b2 { 1 }; // expected-error {{no viable conversion from 'int' to 'dr990::A'}}
28   B b3 { { 1 } };
29 
30   struct C {
31     C();
32     C(int);
33     C(std::initializer_list<int>) = delete; // expected-note {{here}}
34   };
35   C c1[3] { 1 }; // ok
36   C c2[3] { 1, {2} }; // expected-error {{call to deleted}}
37 
38   struct D {
39     D();
40     D(std::initializer_list<int>);
41     D(std::initializer_list<double>);
42   };
43   D d{};
44 #endif
45 }
46