fork(1) download
  1.  
  2.  
  3. template <class T> int bit_sizeof(T unused) {
  4. long long a,b,c;
  5. T x;
  6. x^=x;
  7. x|=1;
  8. a=b=c=x;
  9. b<<=8;
  10. c<<=3;
  11. x=b;
  12. while (x) {
  13. a<<=1;
  14. b<<=c;
  15. c<<=1;
  16. x=b;
  17. }
  18. return a;
  19. }
  20.  
  21.  
  22. int main() {
  23. int* pInt;
  24. auto i = bit_sizeof(pInt);
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:24:8: warning: unused variable ‘i’ [-Wunused-variable]
   auto i = bit_sizeof(pInt);
        ^
prog.cpp: In instantiation of ‘int bit_sizeof(T) [with T = int*]’:
prog.cpp:24:27:   required from here
prog.cpp:6:14: error: invalid operands of types ‘int*’ and ‘int*’ to binary ‘operator^’
             x^=x;
              ^
prog.cpp:6:14: error:   in evaluation of ‘operator^=(int*, int*)’
prog.cpp:7:14: error: invalid operands of types ‘int*’ and ‘int’ to binary ‘operator|’
             x|=1;
              ^
prog.cpp:7:14: error:   in evaluation of ‘operator|=(int*, int)’
prog.cpp:8:18: error: invalid conversion from ‘int*’ to ‘long long int’ [-fpermissive]
             a=b=c=x;
                  ^
prog.cpp:11:14: error: invalid conversion from ‘long long int’ to ‘int*’ [-fpermissive]
             x=b;
              ^
prog.cpp:16:22: error: invalid conversion from ‘long long int’ to ‘int*’ [-fpermissive]
                     x=b;
                      ^
stdout
Standard output is empty