llvm-project/clang/test/Sema/pragma-ms-alloc-text.c
Stephen Long f382545b2b [clang-cl] Handle some pragma alloc_text corner cases handled by MSVC
MSVC's pragma alloc_text accepts a function that was redeclared in
a non extern-C context if the previous declaration was in an extern-C
context. i.e.

```
extern "C" { static void f(); }
static void f();
```

MSVC's pragma alloc_text also rejects non-functions.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D128649
2022-06-29 06:45:59 -07:00

13 lines
328 B
C

// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
void foo();
#pragma alloc_text("hello", foo) // no-error
void foo() {}
static void foo1();
#pragma alloc_text("hello", foo1) // no-error
void foo1() {}
int foo2;
#pragma alloc_text(c, foo2) // expected-error {{'#pragma alloc_text' is applicable only to functions}}