From e7d59be72fa9bc8435da45f4e98c6048b1ffa661 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Tue, 19 Apr 2016 06:19:52 +0000 Subject: Warn if function or variable cannot be implicitly instantiated With this patch compiler emits warning if it tries to make implicit instantiation of a template but cannot find the template definition. The warning can be suppressed by explicit instantiation declaration or by command line options -Wundefined-var-template and -Wundefined-func-template. The implementation follows the discussion of http://reviews.llvm.org/D12326. Differential Revision: http://reviews.llvm.org/D16396 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266719 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaCXX/undefined-internal.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'test/SemaCXX/undefined-internal.cpp') diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp index 29ca5de6d4..59e6fdf9af 100644 --- a/test/SemaCXX/undefined-internal.cpp +++ b/test/SemaCXX/undefined-internal.cpp @@ -82,6 +82,7 @@ namespace test5 { static int var; // expected-warning {{variable 'test5::B::var' has internal linkage but is not defined}} static void foo(); // expected-warning {{function 'test5::B::foo' has internal linkage but is not defined}} }; + extern template int B::var; void test() { B::var = 0; // expected-note {{used here}} -- cgit v1.2.1