fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. struct test1 {
  6. enum test2 {
  7. test3, test4
  8. };
  9. };
  10.  
  11. template <class T>
  12. typename test1<T>::test2 operator | (typename test1<T>::test2 f1, typename test1<T>::test2 f2) {
  13. return static_cast<typename test1<T>::test2>(
  14. static_cast<unsigned>(f1) | static_cast<unsigned>(f2)
  15. );
  16. }
  17.  
  18. int main() {
  19. test1<int>::test2 flags = test1<int>::test3 | test1<int>::test4;
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:19:60: error: invalid conversion from 'int' to 'test1<int>::test2' [-fpermissive]
  test1<int>::test2 flags = test1<int>::test3 | test1<int>::test4;
                                                            ^
stdout
Standard output is empty