diff options
author | Krystian Stasiowski <sdkrystian@gmail.com> | 2024-02-01 11:19:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-01 11:19:04 -0500 |
commit | c5f461918cece4362fb70c7b16de4e95c1af8e5f (patch) | |
tree | 7b4a17ffdbdf397b2a1e86701492d53e50249b2b /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 9acd61ec1999ac3a54371d0a8b9d922ef5ca2b50 (diff) | |
download | llvm-c5f461918cece4362fb70c7b16de4e95c1af8e5f.zip llvm-c5f461918cece4362fb70c7b16de4e95c1af8e5f.tar.gz llvm-c5f461918cece4362fb70c7b16de4e95c1af8e5f.tar.bz2 |
[Clang][Parse] Diagnose member template declarations with multiple declarators (#78243)
According to [temp.pre] p5:
> In a template-declaration, explicit specialization, or explicit instantiation the init-declarator-list in the declaration shall contain at most one declarator.
A member-declaration that is a template-declaration or explicit-specialization contains a declaration, even though it declares a member. This means it _will_ contain an init-declarator-list (not a member-declarator-list), so [temp.pre] p5 applies.
This diagnoses declarations such as:
```
struct A
{
template<typename T>
static const int x = 0, f(); // error: a template declaration can only declare a single entity
template<typename T>
static const int g(), y = 0; // error: a template declaration can only declare a single entity
};
```
The diagnostic messages are the same as those of the equivalent namespace scope declarations.
Note: since we currently do not diagnose declarations with multiple abbreviated function template declarators at namespace scope e.g., `void f(auto), g(auto);`, so this patch does not add diagnostics for the equivalent member declarations.
This patch also refactors `ParseSingleDeclarationAfterTemplate` (now named `ParseDeclarationAfterTemplate`) to call `ParseDeclGroup` and return the resultant `DeclGroup`.
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions