1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -triple=i686-pc-linux-gnu 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc void ugly_news(int *ip) { 4*f4a2713aSLionel Sambuc // These are ill-formed according to one reading of C++98, and at the least 5*f4a2713aSLionel Sambuc // have undefined behavior. But they're well-formed, and defined to throw 6*f4a2713aSLionel Sambuc // std::bad_array_new_length, in C++11. 7*f4a2713aSLionel Sambuc (void)new int[-1]; // expected-warning {{array size is negative}} 8*f4a2713aSLionel Sambuc (void)new int[2000000000]; // expected-warning {{array is too large}} 9*f4a2713aSLionel Sambuc } 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc struct S { 13*f4a2713aSLionel Sambuc S(int); 14*f4a2713aSLionel Sambuc S(); 15*f4a2713aSLionel Sambuc ~S(); 16*f4a2713aSLionel Sambuc }; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc struct T { // expected-note 2 {{not viable}} 19*f4a2713aSLionel Sambuc T(int); // expected-note {{not viable}} 20*f4a2713aSLionel Sambuc }; 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc void fn() { 23*f4a2713aSLionel Sambuc (void) new int[2] {1, 2}; 24*f4a2713aSLionel Sambuc (void) new S[2] {1, 2}; 25*f4a2713aSLionel Sambuc (void) new T[2] {1, 2}; // expected-error {{no matching constructor}} 26*f4a2713aSLionel Sambuc } 27