Akira Hatanaka | 3e34cfe | 2016-09-01 01:03:21 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | extern int array[1]; |
| 5 | |
| 6 | template <typename> |
| 7 | class C { |
| 8 | enum { D }; |
| 9 | public: |
| 10 | template <typename A> void foo1() { |
| 11 | extern int array[((int)C<A>::k > (int)D) ? 1 : -1]; |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | template<> |
| 16 | class C<int> { |
| 17 | public: |
| 18 | const static int k = 2; |
| 19 | }; |
| 20 | |
| 21 | void foo2() { |
| 22 | C<char> c; |
| 23 | c.foo1<int>(); |
| 24 | } |
| 25 | |
| 26 | template<int n> |
| 27 | void foo3() { |
| 28 | extern int array[n ? 1 : -1]; |
| 29 | } |
| 30 | |
| 31 | void foo4() { |
| 32 | foo3<5>(); |
| 33 | } |
Richard Smith | 1b8125b | 2020-06-16 19:27:54 -0700 | [diff] [blame^] | 34 | |
| 35 | namespace NS { |
| 36 | int f() { extern int arr[3]; { extern int arr[]; } return 0; } |
| 37 | template<typename T> void g() { extern int arr[3]; extern T arr; } |
| 38 | template void g<int[]>(); |
| 39 | } |