Skip to content

Commit

Permalink
[clang] Add test for CWG1821
Browse files Browse the repository at this point in the history
[[https://wg21.link/p1787 | P1787]]: My clarification in [[ http://lists.isocpp.org/core/2019/06/6614.php | “Where can namespace-scope functions and variables be redeclared?” ]] is applied, resolving CWG1821.
Wording: (If the declaration is not a friend declaration:) If the id-expression in a declarator-id is a qualified-id Q, let S be its lookup context; the declaration shall inhabit a namespace scope. ([dcl.meaning]/1)

Reviewed By: shafik, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D149003
  • Loading branch information
Endilll committed Apr 25, 2023
1 parent 68dd514 commit 5cda0d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions clang/test/CXX/drs/dr18xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ namespace dr1815 { // dr1815: no
#endif
}

namespace dr1821 { // dr1821: yes
struct A {
template <typename> struct B {
void f();
};
template <typename T> void B<T>::f(){};
// expected-error@-1 {{non-friend class member 'f' cannot have a qualified name}}

struct C {
void f();
};
void C::f() {}
// expected-error@-1 {{non-friend class member 'f' cannot have a qualified name}}
};
} // namespace dr1821

namespace dr1822 { // dr1822: yes
#if __cplusplus >= 201103L
int a;
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 @@ -10733,7 +10733,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/1821.html">1821</a></td>
<td>CD6</td>
<td>Qualified redeclarations in a class <I>member-specification</I></td>
<td class="none" align="center">Unknown</td>
<td class="full" align="center">Yes</td>
</tr>
<tr id="1822">
<td><a href="https://cplusplus.github.io/CWG/issues/1822.html">1822</a></td>
Expand Down

0 comments on commit 5cda0d1

Please sign in to comment.