[clang] fix bug that undefined internal is a warning only for -pedantic-errors (PR #98016)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 11 05:06:54 PDT 2024
================
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic-errors
+
+static void *f(void); // expected-error {{function 'f' has internal linkage but is not defined}}
+
+int main(void)
+{
+ int j = _Generic(&f, void *(*)(void): 10, default: 20);
+ // expected-no-diagnostic at -1
+
+ void *k = _Generic(&f, void *(*)(void): f(), default: 20);
----------------
AaronBallman wrote:
```suggestion
int j = _Generic(&f, void (*)(void): 0);
void *k = _Generic(&f, void (*)(void): f, default: 0); // expected-note {{used here}}
```
https://github.com/llvm/llvm-project/pull/98016
More information about the cfe-commits
mailing list