Debian Codegraph @

gcc/testsuite/g++.dg/template/friend79.C

raw
1 // PR c++/109923
2
3 template<class T>
4 struct A {
5 private:
6 int x;
7
8 public:
9 A() : x(0) { }
10
11 friend void non_templ_friend(A val, A<void> weird) {
12 val.x++; // always works
13 weird.x++; // { dg-error "private" } should only work when T=void
14 }
15 };
16
17 int main() {
18 non_templ_friend(A<void>(), A<void>()); // { dg-bogus "" }
19 non_templ_friend(A<int>(), A<void>()); // { dg-message "required from here" }
20 }