Momchil Velikov | 57c681f | 2017-08-10 15:43:06 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 %s -std=c90 -verify -fsyntax-only |
| 2 | void t0(int x) { |
| 3 | int (*p)(); |
| 4 | if(x > 0) |
| 5 | x = g() + 1; |
| 6 | p = g; |
| 7 | if(x < 0) { |
| 8 | extern void u(int (*)[h()]); |
| 9 | int (*q)() = h; |
| 10 | } |
| 11 | p = h; /* expected-error {{use of undeclared identifier 'h'}} */ |
| 12 | } |
| 13 | |
| 14 | void t1(int x) { |
| 15 | int (*p)(); |
| 16 | switch (x) { |
| 17 | g(); |
| 18 | case 0: |
| 19 | x = h() + 1; |
| 20 | break; |
| 21 | case 1: |
| 22 | p = g; |
| 23 | p = h; |
| 24 | break; |
| 25 | } |
| 26 | p = g; /* expected-error {{use of undeclared identifier 'g'}} */ |
| 27 | p = h; /* expected-error {{use of undeclared identifier 'h'}} */ |
| 28 | } |
| 29 | |
| 30 | int t2(int x) { |
| 31 | int y = ({ if (x > 0) x = g() + 1; 2*x; }); |
| 32 | int (*p)() = g; /* expected-error {{use of undeclared identifier 'g'}} */ |
| 33 | return y; |
| 34 | } |
| 35 | |
| 36 | int (*p)() = g; /* expected-error {{use of undeclared identifier 'g'}} */ |
| 37 | int (*q)() = h; /* expected-error {{use of undeclared identifier 'h'}} */ |
| 38 | |
| 39 | float g(); /* not expecting conflicting types diagnostics here */ |