Debian Codegraph @

clang/test/Sema/type-dependent-attrs.c

raw
1 // RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s
2
3 int open() { return 0; }
4 void close(typeof(open()) *) {}
5
6 void cleanup_attr() {
7 int fd_int [[gnu::cleanup(close)]] = open();
8 auto fd_auto [[gnu::cleanup(close)]] = open();
9 float fd_invalid [[gnu::cleanup(close)]] = open(); // expected-error {{'cleanup' function 'close' parameter has type 'typeof (open()) *' (aka 'int *') which is incompatible with type 'float *'}}
10 }