llvm-project/clang/test/Sema/ptrauth-struct-function-ptr-field.c
Oliver Hunt 1c68e0e481
[clang][ptrauth] reject incorrectly placed ptrauth qualifier (#138376)
When parsing a function pointer typed field we use
Parser::ParseTypeQualifierListOpt, but then drops subsequent type
attributes and qualifiers unless explicitly handled.

There is an existing solution for the _Atomic qualifier, and this PR
simply extends that to __ptrauth for now. In future we may want to
investigate a more robust mechanism to ensure type qualifiers are not
silently dropped so that future type qualifiers do not suffer the same
problem.
2025-05-03 01:18:20 -07:00

8 lines
391 B
C

// RUN: %clang_cc1 -triple arm64-apple-ios -x c -fsyntax-only -verify -fptrauth-intrinsics %s -fexperimental-new-constant-interpreter
// RUN: %clang_cc1 -triple arm64-apple-ios -x c++ -fsyntax-only -verify -fptrauth-intrinsics %s -fexperimental-new-constant-interpreter
struct Foo {
void (*f)(int) __ptrauth(1,1,1);
// expected-error@-1 {{expected ';' at end of declaration list}}
};