Skip to content

[clang] Add test for CWG1820 "Qualified typedef names" #91765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
47 changes: 47 additions & 0 deletions clang/test/CXX/drs/cwg18xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,53 @@ namespace cwg1815 { // cwg1815: no
#endif
}

namespace cwg1820 { // cwg1820: 3.5
typedef int A;
typedef int cwg1820::A;
// expected-warning@-1 {{extra qualification on member 'A'}}
// expected-error@-2 {{typedef declarator cannot be qualified}}

namespace B {
typedef int cwg1820::A;
// expected-error@-1 {{cannot define or redeclare 'A' here because namespace 'B' does not enclose namespace 'cwg1820'}}
// expected-error@-2 {{typedef declarator cannot be qualified}}
}

class C1 {
typedef int cwg1820::A;
// expected-error@-1 {{non-friend class member 'A' cannot have a qualified name}}
// expected-error@-2 {{typedef declarator cannot be qualified}}
};

template <typename>
class C2 {
typedef int cwg1820::A;
// expected-error@-1 {{non-friend class member 'A' cannot have a qualified name}}
// expected-error@-2 {{typedef declarator cannot be qualified}}
};

void d1() {
typedef int cwg1820::A;
// expected-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}}
// expected-error@-2 {{typedef declarator cannot be qualified}}
}

template<typename>
void d2() {
typedef int cwg1820::A;
// expected-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}}
// expected-error@-2 {{typedef declarator cannot be qualified}}
}

#if __cplusplus >= 201103L
auto e = [] {
typedef int cwg1820::A;
// expected-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}}
// expected-error@-2 {{typedef declarator cannot be qualified}}
};
#endif
} // namespace cwg1820

namespace cwg1821 { // cwg1821: 2.9
struct A {
template <typename> struct B {
Expand Down
2 changes: 1 addition & 1 deletion clang/www/cxx_dr_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -10728,7 +10728,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/1820.html">1820</a></td>
<td>CD6</td>
<td>Qualified typedef names</td>
<td class="unknown" align="center">Unknown</td>
<td class="full" align="center">Clang 3.5</td>
</tr>
<tr id="1821">
<td><a href="https://cplusplus.github.io/CWG/issues/1821.html">1821</a></td>
Expand Down
Loading