diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-09-20 07:22:00 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-09-20 07:22:00 +0000 |
commit | 4e8386f480e758e0e5e9c26c7439ac7bf9a71d23 (patch) | |
tree | 6fcb3c4875d5c2ec71f89351ee84dc87c16d2d52 /test/CodeGenCXX/mangle-ms-cxx11.cpp | |
parent | 8385a295e2d9a3f7ea56000826056d669d562dab (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle-ms-cxx11.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-ms-cxx11.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/CodeGenCXX/mangle-ms-cxx11.cpp b/test/CodeGenCXX/mangle-ms-cxx11.cpp index 819b0d9c9d..b22c04698e 100644 --- a/test/CodeGenCXX/mangle-ms-cxx11.cpp +++ b/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); } |