Home | History | Annotate | Download | only in expr.new
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
      2 
      3 template<typename T>
      4 struct only {
      5   only(T);
      6   template<typename U> only(U) = delete;
      7 };
      8 
      9 void f() {
     10   only<const int*> p = new const auto (0);
     11   only<double*> q = new (auto) (0.0);
     12 
     13   new auto; // expected-error{{new expression for type 'auto' requires a constructor argument}}
     14   new (const auto)(); // expected-error{{new expression for type 'auto const' requires a constructor argument}}
     15   new (auto) (1,2,3); // expected-error{{new expression for type 'auto' contains multiple constructor arguments}}
     16 }
     17 
     18 void p2example() {
     19   only<int*> r = new auto(1);
     20   auto x = new auto('a');
     21 
     22   only<char*> testX = x;
     23 }
     24