12368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
22368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
32368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher// This is a testcase for LLVM PR445, which was a problem where the
42368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher// instantiation of callDefaultCtor was not being emitted correctly.
52368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
62368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher// CHECK-NOT: declare{{.*}}callDefaultCtor
72368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopherstruct Pass {};
82368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
92368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christophertemplate<typename PassName>
102368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric ChristopherPass *callDefaultCtor() { return new Pass(); }
112368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
122368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christophervoid foo(Pass *(*C)());
132368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
142368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopherstruct basic_string {
152368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher  bool empty() const { return true; }
162368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher};
172368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
182368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher
192368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopherbool foo2(basic_string &X) {
202368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher  return X.empty();
212368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christopher}
222368b6af4a5f0c07c7b77f8900a956dce75bbf84Eric Christophervoid baz() { foo(callDefaultCtor<Pass>); }
23