summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-08-04 16:48:43 +0000
committerHans Wennborg <hans@hanshq.net>2017-08-04 16:48:43 +0000
commit9ac40524fe1216e5d8e475e0cd24a2bd2f55cedd (patch)
treeb45ff20be8b4bf52f051d951d9dc9970551ada43
parent676729f19a8b81c98a72239633feecdb54ed08cf (diff)
Merging r309975: (except the docs/ part)
------------------------------------------------------------------------ r309975 | rsmith | 2017-08-03 12:24:27 -0700 (Thu, 03 Aug 2017) | 4 lines Don't emit undefined-internal warnings for CXXDeductionGuideDecls. Patch by ~paul (cynecx on phabricator)! Some test massaging by me. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@310067 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/Sema.cpp3
-rw-r--r--test/SemaCXX/cxx1z-class-template-argument-deduction.cpp25
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 6f0db6ce1c..a18f71422f 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -542,6 +542,9 @@ void Sema::getUndefinedButUsed(
// __attribute__((weakref)) is basically a definition.
if (ND->hasAttr<WeakRefAttr>()) continue;
+ if (isa<CXXDeductionGuideDecl>(ND))
+ continue;
+
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
if (FD->isDefined())
continue;
diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
index 159b7072e6..668c242802 100644
--- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -1,4 +1,9 @@
-// RUN: %clang_cc1 -std=c++1z -verify %s
+// RUN: %clang_cc1 -std=c++1z -verify %s -DERRORS
+// RUN: %clang_cc1 -std=c++1z -verify %s -UERRORS
+
+// This test is split into two because we only produce "undefined internal"
+// warnings if we didn't produce any errors.
+#if ERRORS
namespace std {
using size_t = decltype(sizeof(0));
@@ -280,3 +285,21 @@ namespace tuple_tests {
scoped_lock l = {};
}
}
+
+#else
+
+// expected-no-diagnostics
+namespace undefined_warnings {
+ // Make sure we don't get an "undefined but used internal symbol" warning for the deduction guide here.
+ namespace {
+ template <typename T>
+ struct TemplDObj {
+ explicit TemplDObj(T func) noexcept {}
+ };
+ auto test1 = TemplDObj(0);
+
+ TemplDObj(float) -> TemplDObj<double>;
+ auto test2 = TemplDObj(.0f);
+ }
+}
+#endif