This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add test for CWG952
ClosedPublic

Authored by Endill on Dec 5 2022, 6:29 AM.

Details

Reviewers
erichkeane
aaron.ballman
Group Reviewers
Restricted Project
Commits
rG5b22c5129c11: [clang] Add test for CWG952
Summary

P1787: CWG952 is resolved by refining the definition of “naming class” per Richard’s suggestion in “CWG1621 and [class.static/2”.
Wording:

  • [class.static]/2 removed;
  • [class.access.base]/5 rephrased.

Currently behavior is the following: unqualified names undergo unqualified name lookup [1], which perform unqualified search in immediate scope [2]. This scope is the scope the definition of naming class [3] refers to. A::I is not accessible when named in classes C and D per [3]. In particular, the last item regarding base class ([class.access.base]/5.4) is not applicable, because class A is not accessible in both classes C and D per [4].

References:

  1. basic.lookup.unqual/4
  2. basic.lookup.unqual/3
  3. class.access.base/5
  4. class.access.base/4

Diff Detail

Event Timeline

Endill created this revision.Dec 5 2022, 6:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 6:29 AM
Endill requested review of this revision.Dec 5 2022, 6:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 6:29 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane accepted this revision.Dec 5 2022, 6:57 AM
erichkeane added a subscriber: erichkeane.

This appears right to me! I'd like others to take a look though.

This revision is now accepted and ready to land.Dec 5 2022, 6:57 AM
aaron.ballman accepted this revision.Dec 5 2022, 11:43 AM
aaron.ballman added a subscriber: aaron.ballman.

LGTM, though I would appreciate another test (that I expect to pass).

clang/test/CXX/drs/dr9xx.cpp
76

I wouldn't mind another test case:

struct A {
protected:
  static int x;
};
struct B : A {
  friend int get(B) { return x; }
};

this was something Richard had pointed out needs to still work as part of the reflector discussions of this issue.

This revision was landed with ongoing or failed builds.Dec 6 2022, 1:27 AM
This revision was automatically updated to reflect the committed changes.
Endill added inline comments.Jan 23 2023, 2:20 AM
clang/test/CXX/drs/dr9xx.cpp
76

Sorry, it seems I missed your comment when I landed the patch. Would it be fine to add this test as NFC patch?