Title
Access checking in friends involving qualified-ids
Status
open
Section
11.8.1 [class.access.general]
Submitter
Corentin Jabot

Created on 2025-05-24.00:00:00 last changed 4 months ago

Messages

Date: 2025-05-24.00:00:00

(From submission #709.)

Consider:

  class D {
    class E {
      class F {};
      friend void foo1(D::E::F& q);
    };
    friend void foo1(D::E::F& q);
  };
  void foo1(D::E::F& q) {}

The specification in 11.8.1 [class.access.general] paragraph 6 leads to the question whether we are "naming F from the declaration" of ::D or of ::foo1. There is implementation divergence.

Another example:

  class G {
    using T = int;
    friend void foo(T);
  };

  class H {
    friend void foo(G::T);
  }

It might be desirable to carve out a special rule for friend declarations, allowing both examples, because earlier friend declarations have already granted access.

History
Date User Action Args
2025-05-24 00:00:00admincreate