diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-03-02 00:19:53 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-03-02 00:19:53 +0000 |
| commit | 5a80bd15044647ff15e12bd7b1605d82e2d0cd97 (patch) | |
| tree | fd0d3d411b0366d80cd0daef039eaef2b4f17a11 /clang/test | |
| parent | a9e981225e050a02c79c68537779b36289d2115b (diff) | |
| download | bcm5719-llvm-5a80bd15044647ff15e12bd7b1605d82e2d0cd97.tar.gz bcm5719-llvm-5a80bd15044647ff15e12bd7b1605d82e2d0cd97.zip | |
Rework the way we find locally-scoped external declarations when we
need them to evaluate redeclarations or call a function that hasn't
already been declared. We now keep a DenseMap of these locally-scoped
declarations so that they are not visible but can be quickly found,
e.g., when we're looking for previous declarations or before we go
ahead and implicitly declare a function that's being called. Fixes
PR3672.
llvm-svn: 65792
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Sema/function-redecl.c | 7 | ||||
| -rw-r--r-- | clang/test/Sema/var-redecl.c | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Sema/function-redecl.c b/clang/test/Sema/function-redecl.c index e8252db343d..4ba97c2a8fd 100644 --- a/clang/test/Sema/function-redecl.c +++ b/clang/test/Sema/function-redecl.c @@ -74,6 +74,7 @@ void outer_test() { int outer5(int); // expected-error{{redefinition of 'outer5' as different kind of symbol}} int* outer6(int); // expected-note{{previous declaration is here}} int *outer7(int); + int outer8(int); int *ip7 = outer7(6); } @@ -86,3 +87,9 @@ void outer_test2(int x) { int* ip = outer6(x); // expected-warning{{use of out-of-scope declaration of 'outer6'}} int *ip2 = outer7(x); } + +void outer_test3() { + int *(*fp)(int) = outer8; // expected-error{{use of undeclared identifier 'outer8'}} +} + +static float outer8(float); // okay diff --git a/clang/test/Sema/var-redecl.c b/clang/test/Sema/var-redecl.c index 317a0f578f6..82ce58bcb9c 100644 --- a/clang/test/Sema/var-redecl.c +++ b/clang/test/Sema/var-redecl.c @@ -49,3 +49,8 @@ void outer_shadowing_test() { } } } + +void g18(void) { + extern int g19; +} +int *p=&g19; // expected-error{{use of undeclared identifier 'g19'}} |

