fork download
  1. #include <iostream>
  2.  
  3. class A
  4. {
  5. int a;
  6. };
  7.  
  8. template<typename, typename = void>
  9. struct test
  10. {};
  11.  
  12. template<typename T>
  13. struct test<T, decltype(T::a)>
  14. {};
  15.  
  16. int main()
  17. {
  18. test<A> a;
  19. }
Compilation error #stdin compilation error #stdout 0s 3464KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:5:9: error: 'int A::a' is private
     int a;
         ^
prog.cpp:18:13: error: within this context
     test<A> a;
             ^
stdout
Standard output is empty