summaryrefslogtreecommitdiff
path: root/test/SemaCXX/function-redecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-08-13 18:18:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-08-13 18:18:50 +0000
commitdd9459f8869f66409f7ea429053b453e33f6499c (patch)
treea2da98d24ea77e1e6e0c76f8f793ab8fc1a5e072 /test/SemaCXX/function-redecl.cpp
parentf758bc7125d59bca12bb6c5f1d3c9025f395710e (diff)
downloadclang-dd9459f8869f66409f7ea429053b453e33f6499c.tar.gz
Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:
When a local extern declaration redeclares some other entity, the type of that entity is merged with the prior type if the prior declaration is visible (in C) or is declared in the same scope (in C++). - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right set of cases, and make it track whether it found a shadowed declaration. - Track whether we found a declaration in the same scope (for C++) including across serialization and template instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/function-redecl.cpp')
-rw-r--r--test/SemaCXX/function-redecl.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/SemaCXX/function-redecl.cpp b/test/SemaCXX/function-redecl.cpp
index b9d1f23af4..deb8e9d37f 100644
--- a/test/SemaCXX/function-redecl.cpp
+++ b/test/SemaCXX/function-redecl.cpp
@@ -4,22 +4,27 @@ int foo(int);
namespace N {
void f1() {
void foo(int); // okay
+ void bar(int);
}
- // FIXME: we shouldn't even need this declaration to detect errors
- // below.
- void foo(int); // expected-note{{previous declaration is here}}
+ void foo(int); // expected-note 2{{previous declaration is here}}
void f2() {
- int foo(int); // expected-error{{functions that differ only in their return type cannot be overloaded}}
+ int foo(int); // expected-error {{functions that differ only in their return type cannot be overloaded}}
+ // FIXME: We should be able to diagnose the conflict between this
+ // declaration of 'bar' and the previous one, even though they come
+ // from different lexical scopes.
+ int bar(int); // expected-note {{previous declaration is here}}
+ int baz(int); // expected-note {{previous declaration is here}}
{
int foo;
+ int bar;
+ int baz;
{
- // FIXME: should diagnose this because it's incompatible with
- // N::foo. However, name lookup isn't properly "skipping" the
- // "int foo" above.
- float foo(int);
+ float foo(int); // expected-error {{functions that differ only in their return type cannot be overloaded}}
+ float bar(int); // expected-error {{functions that differ only in their return type cannot be overloaded}}
+ float baz(int); // expected-error {{functions that differ only in their return type cannot be overloaded}}
}
}
}