51 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s2 3namespace t1 {4template <class T> struct VSX {5 ~VSX() { static_assert(sizeof(T) != 4, ""); } // expected-error {{static assertion failed due to requirement 'sizeof(int) != 4':}} \6 // expected-note {{expression evaluates to '4 != 4'}}7};8struct VS {9 union {10 VSX<int> _Tail;11 };12 ~VS() { }13 VS(short);14 VS();15};16VS::VS() : VS(0) { } // delegating constructors should not produce errors17VS::VS(short) : _Tail() { } // expected-note {{in instantiation of member function 't1::VSX<int>::~VSX' requested here}}18}19 20 21namespace t2 {22template <class T> struct VSX {23 ~VSX() { static_assert(sizeof(T) != 4, ""); } // expected-error {{static assertion failed due to requirement 'sizeof(int) != 4':}} \24 // expected-note {{expression evaluates to '4 != 4'}}25};26struct VS {27 union {28 struct {29 VSX<int> _Tail;30 };31 };32 ~VS() { }33 VS(short);34};35VS::VS(short) : _Tail() { } // expected-note {{in instantiation of member function 't2::VSX<int>::~VSX' requested here}}36}37 38 39namespace t3 {40template <class T> struct VSX {41 ~VSX() { static_assert(sizeof(T) != 4, ""); } // expected-error {{static assertion failed due to requirement 'sizeof(int) != 4':}} \42 // expected-note {{expression evaluates to '4 != 4'}}43};44union VS {45 VSX<int> _Tail;46 ~VS() { }47 VS(short);48};49VS::VS(short) : _Tail() { } // expected-note {{in instantiation of member function 't3::VSX<int>::~VSX' requested here}}50}51