// RUN: %clang_cc1 -fsyntax-only -verify %s void abort() __attribute__((noreturn)); class Okay { int a_; }; class Virtual { virtual void foo() { abort(); } // expected-note 3 {{because type 'Virtual' has a virtual member function}} }; class VirtualBase : virtual Okay { // expected-note 3 {{because type 'VirtualBase' has a virtual base class}} }; class Ctor { Ctor() { abort(); } // expected-note 3 {{because type 'Ctor' has a user-declared constructor}} }; class Ctor2 { Ctor2(); // expected-note 3 {{because type 'Ctor2' has a user-declared constructor}} }; class CopyCtor { CopyCtor(CopyCtor &cc) { abort(); } // expected-note 3 {{because type 'CopyCtor' has a user-declared copy constructor}} }; // FIXME: this should eventually trigger on the operator's declaration line class CopyAssign { // expected-note 3 {{because type 'CopyAssign' has a user-declared copy assignment operator}} CopyAssign& operator=(CopyAssign& CA) { abort(); } }; class Dtor { ~Dtor() { abort(); } // expected-note 3 {{because type 'Dtor' has a user-declared destructor}} }; union U1 { Virtual v; // expected-error {{union member 'v' has a non-trivial copy constructor}} VirtualBase vbase; // expected-error {{union member 'vbase' has a non-trivial copy constructor}} Ctor ctor; // expected-error {{union member 'ctor' has a non-trivial constructor}} Ctor2 ctor2; // expected-error {{union member 'ctor2' has a non-trivial constructor}} CopyCtor copyctor; // expected-error {{union member 'copyctor' has a non-trivial copy constructor}} CopyAssign copyassign; // expected-error {{union member 'copyassign' has a non-trivial copy assignment operator}} Dtor dtor; // expected-error {{union member 'dtor' has a non-trivial destructor}} Okay okay; }; union U2 { struct { Virtual v; // expected-note {{because type 'U2:: struct Either { bool tag; union { A a; B b; }; Either(A& a) : tag(true), a(a) {} Either(B& b) : tag(false), b(b) {} }; /* FIXME: this should work, but crashes in template code. void fred() { Either virt(0); Either vbase(0); Either ctor(0); Either copyctor(0); Either copyassign(0); Either dtor(0); Either okay(0); } */