diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-04 19:26:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-04 19:26:32 +0000 |
commit | 2dbe4043e8f54578bd21e766c99986ac464516ec (patch) | |
tree | d2ce18b29c8b6247ef8cf4c7ff3b3b38544dd933 /clang/test/Modules | |
parent | 337675b8915f51f088a49aff987715324ad44f00 (diff) | |
download | bcm5719-llvm-2dbe4043e8f54578bd21e766c99986ac464516ec.tar.gz bcm5719-llvm-2dbe4043e8f54578bd21e766c99986ac464516ec.zip |
[modules] Generalize the workaround for multiple ambiguous definitions of
internal linkage entities in different modules from r250884 to apply to all
names, not just function names.
This is really awkward: we don't want to merge internal-linkage symbols from
separate modules, because they might not actually be defining the same entity.
But we don't want to reject programs that use such an ambiguous symbol if those
internal-linkage symbols are in fact equivalent. For now, we're resolving the
ambiguity by picking one of the equivalent definitions as an extension.
llvm-svn: 252063
Diffstat (limited to 'clang/test/Modules')
3 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h index e079bd0908e..09713699133 100644 --- a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h +++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h @@ -1,4 +1,5 @@ #ifndef A_H #define A_H static inline void f() {} +constexpr int n = 0; #endif diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h index 1627bfb99e2..efec99f003d 100644 --- a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h +++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h @@ -1,3 +1,4 @@ #include "b.h" #include "c.h" inline void g() { f(); } +inline int h() { return n; } diff --git a/clang/test/Modules/libstdcxx-ambiguous-internal.cpp b/clang/test/Modules/libstdcxx-ambiguous-internal.cpp index 966b9c97681..784b442eab4 100644 --- a/clang/test/Modules/libstdcxx-ambiguous-internal.cpp +++ b/clang/test/Modules/libstdcxx-ambiguous-internal.cpp @@ -3,5 +3,11 @@ // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -emit-module -fmodule-name=std -fmodules-cache-path=%t %S/Inputs/libstdcxx-ambiguous-internal/module.modulemap -fmodules-local-submodule-visibility -DAMBIGUOUS 2>&1| FileCheck %s // CHECK-NOT: error -// CHECK: warning: ambiguous use of internal linkage function 'f' defined in multiple modules +// CHECK: warning: ambiguous use of internal linkage declaration 'f' defined in multiple modules +// CHECK: note: declared here in module 'std.C' +// CHECK: note: declared here in module 'std.B' +// CHECK-NOT: error +// CHECK: warning: ambiguous use of internal linkage declaration 'n' defined in multiple modules +// CHECK: note: declared here in module 'std.C' +// CHECK: note: declared here in module 'std.B' // CHECK-NOT: error |