]> granicus.if.org Git - clang/commit
Implement C++ [basic.link]p8.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 20 Sep 2017 07:22:00 +0000 (07:22 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 20 Sep 2017 07:22:00 +0000 (07:22 +0000)
commit4e8386f480e758e0e5e9c26c7439ac7bf9a71d23
tree6fcb3c4875d5c2ec71f89351ee84dc87c16d2d52
parent8385a295e2d9a3f7ea56000826056d669d562dab
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
15 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
include/clang/Sema/SemaInternal.h
lib/AST/Decl.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
test/Analysis/malloc.mm
test/Analysis/reference.cpp
test/CXX/basic/basic.link/p8.cpp [new file with mode: 0644]
test/CodeGenCXX/debug-info-method.cpp
test/CodeGenCXX/mangle-ms-cxx11.cpp
test/CodeGenCXX/mangle.cpp
test/PCH/cxx11-lambdas.mm
test/SemaCXX/warn-unreachable.cpp