Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ related warnings within the method body.
particularly relevant for AMDGPU targets, where they map to corresponding IR
metadata.

- Clang now disallows the use of attributes applied before an
``extern template`` declaration (#GH79893).

Improvements to Clang's diagnostics
-----------------------------------

Expand Down
1 change: 1 addition & 0 deletions clang/lib/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ Parser::ParseExternalDeclaration(ParsedAttributes &Attrs,

case tok::kw_extern:
if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) {
ProhibitAttributes(Attrs);
// Extern templates
SourceLocation ExternLoc = ConsumeToken();
SourceLocation TemplateLoc = ConsumeToken();
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Parser/extern-template-attributes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %clang_cc1 -std=c++17 -verify %s

template <class>
struct S {};

[[deprecated]] extern template struct S<int>; // expected-error {{an attribute list cannot appear here}}
Loading