Issue |
134959
|
Summary |
accepts-invalid accessing private member of C++ class from scope specifier
|
Labels |
new issue
|
Assignees |
|
Reporter |
efriedma-quic
|
```
template<int x> class A { static const int xx = 3; template<int y> class B; };
template<int x> template<int y> class A<x>::B { };
template<typename T> T f();
template<> int A<1>::B<A<1>::xx>::* f(){return nullptr;}
```
clang accepts.
gcc produces:
```
<source>: In function 'T f() [with T = int A<1>::B<3>::*]':
<source>:4:22: error: 'template<int y> class A<1>::B' is private within this context
4 | template<> int A<1>::B<A<1>::xx>::* f(){return nullptr;}
| ^
<source>:1:74: note: declared private here
1 | template<int x> class A { static const int xx = 3; template<int y> class B; };
| ^
<source>:4:30: error: 'const int A<1>::xx' is private within this context
4 | template<> int A<1>::B<A<1>::xx>::* f(){return nullptr;}
| ^~
<source>:1:44: note: declared private here
1 | template<int x> class A { static const int xx = 3; template<int y> class B; };
| ^~
```
I think clang is accidentally suppressing the access checks while disambiguating between a template function and a template member.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs