Mark de Wever | ba15d18 | 2023-04-30 15:27:00 +0200 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -std=c++23 -Wall -Wshadow %s |
Corentin Jabot | ff013b6 | 2021-10-08 07:12:46 -0400 | [diff] [blame] | 2 | |
| 3 | void f() { |
| 4 | |
| 5 | for (using foo = int;true;) {} //expected-warning {{unused type alias 'foo'}} |
| 6 | |
| 7 | switch(using foo = int; 0) { //expected-warning {{unused type alias 'foo'}} |
| 8 | case 0: break; |
| 9 | } |
| 10 | |
| 11 | if(using foo = int; false) {} // expected-warning {{unused type alias 'foo'}} |
| 12 | |
| 13 | int x; // expected-warning {{unused variable 'x'}} |
| 14 | if(using x = int; true) {} // expected-warning {{unused type alias 'x'}} |
| 15 | |
| 16 | using y = int; // expected-warning {{unused type alias 'y'}} \ |
| 17 | // expected-note 2{{previous declaration is here}} |
| 18 | |
| 19 | if(using y = double; true) {} // expected-warning {{unused type alias 'y'}} \ |
| 20 | // expected-warning {{declaration shadows a type alias in function 'f'}} |
| 21 | |
| 22 | for(using y = double; true;) { // expected-warning {{declaration shadows a type alias in function 'f'}} |
| 23 | y foo = 0; |
| 24 | (void)foo; |
| 25 | constexpr y var = 0; |
| 26 | static_assert(var == 0); |
| 27 | } |
| 28 | } |