[clang] Enable unguarded availability diagnostic on instantiated template functions (PR #91699)
Cooper Partin via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 11:07:11 PDT 2024
================
@@ -177,16 +177,19 @@ void justAtAvailable(void) {
#ifdef OBJCPP
-int f(char) AVAILABLE_10_12;
+int f(char) AVAILABLE_10_12; // #f_char_def
int f(int);
template <class T> int use_f() {
- // FIXME: We should warn here!
- return f(T());
+ // expected-warning@#f_call {{'f' is only available on macOS 10.12 or newer}}
+ // expected-note@#f_char_inst {{in instantiation of function template specialization 'use_f<char>' requested here}}
+ // expected-note@#f_char_def {{'f' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9}}
+ // expected-note@#f_call {{enclose 'f' in an @available check to silence this warning}}
+ return f(T()); // #f_call
}
int a = use_f<int>();
-int b = use_f<char>();
+int b = use_f<char>(); // #f_char_inst
----------------
coopp wrote:
I don't see other "// $f_foo_inst" comments in other parts of the code. Why was this one special to get one? Was it just for tracking the change?
https://github.com/llvm/llvm-project/pull/91699
More information about the cfe-commits
mailing list