#include <iostream>
template < typename T>
class Key { friend T; Key( ) { } Key( Key const & ) { } } ;
class Foo;
class Bar { public : void special( int a, Key< Foo> ) { } } ;
class Foo { public : void special( ) { Bar( ) .special ( 1 , { } ) ; } } ;
int main( ) {
Foo( ) .special ( ) ;
Bar( ) .special ( 1 , { } ) ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CiAgICBjbGFzcyBLZXkgeyBmcmllbmQgVDsgS2V5KCkge30gS2V5KEtleSBjb25zdCYpIHt9IH07CgogICAgY2xhc3MgRm9vOwoKICAgIGNsYXNzIEJhciB7IHB1YmxpYzogdm9pZCBzcGVjaWFsKGludCBhLCBLZXk8Rm9vPikge30gfTsKCiAgICBjbGFzcyBGb28geyBwdWJsaWM6IHZvaWQgc3BlY2lhbCgpIHsgQmFyKCkuc3BlY2lhbCgxLCB7fSk7IH0gfTsKCmludCBtYWluKCkgewoJRm9vKCkuc3BlY2lhbCgpOwoJQmFyKCkuc3BlY2lhbCgxLCB7fSk7CglyZXR1cm4gMDsKfQ==
compilation info
prog.cpp: In function 'int main()':
prog.cpp:3:27: error: 'Key<T>::Key() [with T = Foo]' is private
class Key { friend T; Key() {} Key(Key const&) {} };
^
prog.cpp:13:21: error: within this context
Bar().special(1, {});
^
stdout