diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-03-12 15:13:56 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-03-12 15:13:56 +0000 |
commit | 10b1d1cf5ebb14b672d6b0c88f5160ad3cf1e988 (patch) | |
tree | a1b90a311d385ee7e782570da34d814c0cfeaf45 /test/SemaCXX/function-redecl.cpp | |
parent | 6c18af24456000e4b7289bc024519efdb796229a (diff) | |
download | clang-10b1d1cf5ebb14b672d6b0c88f5160ad3cf1e988.tar.gz |
Error if an extern C declaration matches a previous hidden extern C declaration.
Without this patch we produce an error for
extern "C" {
void f() {
extern int b;
}
}
extern "C" {
extern float b;
}
but not for
extern "C" {
void f() {
extern int b;
}
}
extern "C" {
float b;
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/function-redecl.cpp')
-rw-r--r-- | test/SemaCXX/function-redecl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/function-redecl.cpp b/test/SemaCXX/function-redecl.cpp index 4a5638f84e..7bf44b1c36 100644 --- a/test/SemaCXX/function-redecl.cpp +++ b/test/SemaCXX/function-redecl.cpp @@ -134,3 +134,14 @@ namespace test3 { } } float test3_x; // expected-error {{redefinition of 'test3_x' with a different type: 'float' vs 'int'}} + +namespace test4 { + extern "C" { + void f() { + extern int b; // expected-note {{previous definition is here}} + } + } + extern "C" { + float b; // expected-error {{redefinition of 'b' with a different type: 'float' vs 'int'}} + } +} |