llvm-project/clang/test/Parser/extern-template-attributes.cpp
Oleksandr T. 08b0c2517e
[Clang] disallow use of attributes before extern template declarations (#136328)
Fixes #79893 


--- 

This PR addresses the issue of _attributes_ being incorrectly allowed on
`extern template` declarations

```cpp
[[deprecated]] extern template struct S<int>;
```
2025-04-21 18:12:07 +03:00

9 lines
430 B
C++

// RUN: %clang_cc1 -std=c++17 -fms-extensions -verify %s
template <class>
struct S {};
[[deprecated]] extern template struct S<int>; // expected-error {{an attribute list cannot appear here}}
__attribute__((deprecated)) extern template struct S<int>; // expected-error {{an attribute list cannot appear here}}
__declspec(deprecated) extern template struct S<int>; // expected-error {{expected unqualified-id}}