Clang emits an undefined-internal warning for the following code:
template <typename T> struct TemplDObj { explicit TemplDObj(T func) noexcept {} }; auto test = TemplDObj([] {});
Warning:
<source>:3:14: warning: function '<deduction guide for TemplDObj><(lambda at example.cpp:6:23)>' has internal linkage but is not defined [-Wundefined-internal] explicit TemplDObj(T func) noexcept {} ^ <source>:6:13: note: used here auto test = TemplDObj([] {}); ^
It doesn't seem right to emit such warning for CXXDeductionGuideDecl.
This patch basically skips over CXXDeductionGuideDecl in Sema::getUndefinedButUsed.
Why do we need to split the test up like this? If there's a reason, the test should include a comment explaining it.