summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-09-20 07:22:00 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-09-20 07:22:00 +0000
commit405e2dbf3767586ab06a8506a6f5754aeb5a613d (patch)
tree7cd5b3ac40b4dd5c57236b1e89445fdec4dc5352 /clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
parent8a65209d0ba5f4553fa1eba89e2e2fcf43c9c01d (diff)
downloadbcm5719-llvm-405e2dbf3767586ab06a8506a6f5754aeb5a613d.tar.gz
bcm5719-llvm-405e2dbf3767586ab06a8506a6f5754aeb5a613d.zip
Implement C++ [basic.link]p8.
If a function or variable has a type with no linkage (and is not extern "C"), any use of it requires a definition within the same translation unit; the idea is that it is not possible to define the entity elsewhere, so any such use is necessarily an error. There is an exception, though: some types formally have no linkage but nonetheless can be referenced from other translation units (for example, this happens to anonymous structures defined within inline functions). For entities with those types, we suppress the diagnostic except under -pedantic. llvm-svn: 313729
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-ms-cxx11.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle-ms-cxx11.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp b/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
index 819b0d9c9d0..b22c04698ea 100644
--- a/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
+++ b/clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
@@ -160,6 +160,8 @@ struct { } a;
decltype(a) fun(decltype(a) x, decltype(a)) { return x; }
// CHECK-DAG: @"\01?fun@PR18022@@YA?AU<unnamed-type-a>@1@U21@0@Z"
+void use_fun() { fun(a, a); }
+
}
inline int define_lambda() {
@@ -280,7 +282,7 @@ void g() {
namespace PR18204 {
template <typename T>
-int f(T *);
+int f(T *) { return 0; }
static union {
int n = f(this);
};
@@ -346,4 +348,5 @@ int call_it = (A::default_args(), 1);
enum { enumerator };
void f(decltype(enumerator)) {}
-// CHECK-DAG: define void @"\01?f@@YAXW4<unnamed-enum-enumerator>@@@Z"(
+// CHECK-DAG: define internal void @"\01?f@@YAXW4<unnamed-enum-enumerator>@@@Z"(
+void use_f() { f(enumerator); }
OpenPOWER on IntegriCloud