A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/microsoft/vscode-cpptools/issues/4717 below:

no error emitted about inaccessible base class member in inline friend function of derived class. · Issue #4717 · microsoft/vscode-cpptools · GitHub

Type: LanguageService

No error emitted about inaccessible base class member in inline friend function of derived class.

Describe the bug

To Reproduce

  1. Create and compile a .cpp file which contains the following codes:
class Base {
 protected:
  int prot_mem;
};

class Sneaky : public Base {
  inline friend void clobber(Sneaky &s) { s.j = s.prot_mem = 0; }
  inline friend void clobber(Base &b) { b.prot_mem = 0; }
  int j;
};

Expected behavior

Identify b.prot_mem as error just as if the error appears in a out-of-class friend function definition:

int Base::prot_mem
protected member "Base::prot_mem" (declared at line 3) is not accessible through a "Base" pointer or object

Screenshots


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4