Patch by Halfdan Ingvarsson!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179598
91177308-0d34-0410-b5e6-
96231b3b80d8
return false;
} else {
// 'static inline' functions are used in headers; don't warn.
- if (FD->getStorageClass() == SC_Static &&
+ // Make sure we get the storage class from the canonical declaration,
+ // since otherwise we will get spurious warnings on specialized
+ // static template functions.
+ if (FD->getCanonicalDecl()->getStorageClass() == SC_Static &&
FD->isInlineSpecified())
return false;
}
};
}
+namespace test7
+{
+ template<typename T>
+ static inline void foo(T) { }
+
+ // This should not emit an unused-function warning since it inherits
+ // the static storage type from the base template.
+ template<>
+ inline void foo(int) { }
+
+ // Partial specialization
+ template<typename T, typename U>
+ static inline void bar(T, U) { }
+
+ template<typename U>
+ inline void bar(int, U) { }
+
+ template<>
+ inline void bar(int, int) { }
+};
+
namespace pr14776 {
namespace {
struct X {};