Issue |
126787
|
Summary |
Initializing base class from derived class: access check missing?
|
Labels |
|
Assignees |
|
Reporter |
csimon-bambecksystems
|
This code is incorrectly accepted in clang 19.1.0:
```
#include <iostream>
class foo
{
public:
foo(int i) { std::cout << "hello foo=" << i << "\n"; }
foo() { std::cout << "hello foo\n"; }
};
class bar: private virtual foo /// N.B.: "private" here means baz cannot access foo
{
};
class baz: public bar
{
public:
// baz(): foo(42) {} // not accepted -- calls inaccessible foo::foo(int) if baz is the most-derived object
// baz(): foo() {} // not accepted -- calls inaccessible foo::foo() if baz is the most-derived object
baz() {} // accepted, incorrectly -- calls inaccessible foo::foo() if baz is the most-derived object!
};
int main()
{
baz b;
std::cout << "goodbye\n";
}
```
Output:
```
hello foo
goodbye
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs