1caf4826eSDouglas Gregor // Test this without pch. 2caf4826eSDouglas Gregor // RUN: %clang_cc1 -include %s -verify -std=c++11 %s 3caf4826eSDouglas Gregor 4caf4826eSDouglas Gregor // Test with pch. 5caf4826eSDouglas Gregor // RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s 6caf4826eSDouglas Gregor // RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s 7caf4826eSDouglas Gregor 8*a45f713cSLuboš Luňák // RUN: %clang_cc1 -std=c++11 -emit-pch -fpch-instantiate-templates -o %t %s 9*a45f713cSLuboš Luňák // RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s 10*a45f713cSLuboš Luňák 11c6e68daaSAndy Gibbs // expected-no-diagnostics 12c6e68daaSAndy Gibbs 13caf4826eSDouglas Gregor #ifndef HEADER 14caf4826eSDouglas Gregor #define HEADER 15caf4826eSDouglas Gregor 16caf4826eSDouglas Gregor template<typename T> 17caf4826eSDouglas Gregor class New { 18caf4826eSDouglas Gregor New(const New&); 19caf4826eSDouglas Gregor 20caf4826eSDouglas Gregor public: clone()21caf4826eSDouglas Gregor New *clone() { 22caf4826eSDouglas Gregor return new New(*this); 23caf4826eSDouglas Gregor } 24caf4826eSDouglas Gregor }; 25caf4826eSDouglas Gregor arr_new(T...v)26b9fb121aSRichard Smithtemplate<typename ...T> int *arr_new(T ...v) { 27b9fb121aSRichard Smith return new int[]{v...}; 28b9fb121aSRichard Smith } 29b9fb121aSRichard Smith 30caf4826eSDouglas Gregor #else 31caf4826eSDouglas Gregor clone_new(New<int> * n)32caf4826eSDouglas GregorNew<int> *clone_new(New<int> *n) { 33caf4826eSDouglas Gregor return n->clone(); 34caf4826eSDouglas Gregor } 35caf4826eSDouglas Gregor 36b9fb121aSRichard Smith int *use_arr_new = arr_new(1, 2, 3); 37b9fb121aSRichard Smith 38caf4826eSDouglas Gregor #endif 39