18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s 2e1b3e629SAnders Carlsson // PR5697 3e1b3e629SAnders Carlsson namespace PR5697 { 4e1b3e629SAnders Carlsson struct A { fPR5697::A5e1b3e629SAnders Carlsson virtual void f() { } 6e1b3e629SAnders Carlsson A(); 7e1b3e629SAnders Carlsson A(int); 8e1b3e629SAnders Carlsson }; 9e1b3e629SAnders Carlsson 10e1b3e629SAnders Carlsson // A does not have a key function, so the first constructor we emit should 11e1b3e629SAnders Carlsson // cause the vtable to be defined (without assertions.) 12*571e2ad0SAnders Carlsson // CHECK: @_ZTVN6PR56971AE = linkonce_odr unnamed_addr constant A()13e1b3e629SAnders CarlssonA::A() { } A(int)14e1b3e629SAnders CarlssonA::A(int) { } 15e1b3e629SAnders Carlsson } 16a318efd1SDouglas Gregor 17a318efd1SDouglas Gregor // Make sure that we don't assert when building the vtable for a class 18a318efd1SDouglas Gregor // template specialization or explicit instantiation with a key 19a318efd1SDouglas Gregor // function. 20a318efd1SDouglas Gregor template<typename T> 21a318efd1SDouglas Gregor struct Base { 22a318efd1SDouglas Gregor virtual ~Base(); 23a318efd1SDouglas Gregor }; 24a318efd1SDouglas Gregor 25a318efd1SDouglas Gregor template<typename T> 26a318efd1SDouglas Gregor struct Derived : public Base<T> { }; 27a318efd1SDouglas Gregor 28a318efd1SDouglas Gregor template<> 29a318efd1SDouglas Gregor struct Derived<char> : public Base<char> { 30a318efd1SDouglas Gregor virtual void anchor(); 31a318efd1SDouglas Gregor }; 32a318efd1SDouglas Gregor anchor()33a318efd1SDouglas Gregorvoid Derived<char>::anchor() { } 34