1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 2 3 enum class N {}; 4 5 using Animal = int; 6 7 using AnimalPtr = Animal *; 8 9 using Man = Animal; 10 using Dog = Animal; 11 12 namespace variable { 13 14 auto x1 = Animal(); 15 N t1 = x1; // expected-error {{lvalue of type 'Animal' (aka 'int')}} 16 17 auto x2 = AnimalPtr(); 18 N t2 = x2; // expected-error {{lvalue of type 'AnimalPtr' (aka 'int *')}} 19 20 auto *x3 = AnimalPtr(); 21 N t3 = x3; // expected-error {{lvalue of type 'Animal *' (aka 'int *')}} 22 23 // Each variable deduces separately. 24 auto x4 = Man(), x5 = Dog(); 25 N t4 = x4; // expected-error {{lvalue of type 'Man' (aka 'int')}} 26 N t5 = x5; // expected-error {{lvalue of type 'Dog' (aka 'int')}} 27 28 } // namespace variable 29 30 namespace function_basic { 31 f1()32auto f1() { return Animal(); } 33 auto x1 = f1(); 34 N t1 = x1; // expected-error {{lvalue of type 'Animal' (aka 'int')}} 35 f2()36decltype(auto) f2() { return Animal(); } 37 auto x2 = f2(); 38 N t2 = x2; // expected-error {{lvalue of type 'Animal' (aka 'int')}} 39 __anon8259c5cc0102null40auto x3 = [a = Animal()] { return a; }(); 41 N t3 = x3; // expected-error {{lvalue of type 'Animal' (aka 'int')}} 42 43 } // namespace function_basic 44