brintos

brintos / llvm-project-archived public Read only

0
0
Text · 429 B · 13068b3 Raw
11 lines · c
1// RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s2 3int open() { return 0; }4void close(typeof(open()) *) {}5 6void 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}11