fork download
  1. #include <iostream>
  2.  
  3.  
  4. int main() {
  5.  
  6.     typedef union Complex {
  7.  
  8.         double re;
  9.  
  10.         double im;
  11.  
  12.     } Complex;
  13.  
  14.     const Complex c = {46} ;
  15.  
  16.     c.im= 59;
  17.  
  18.     cout << c.re;
  19.  
  20.     return 0;
  21.  
  22. }
  23.  
  24.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    typedef union Complex {
^
prog.cpp:6:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    typedef union Complex {
  ^
prog.cpp:8:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double re;
^
prog.cpp:8:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double re;
  ^
prog.cpp:8:7: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double re;
    ^
prog.cpp:8:10: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double re;
      ^
prog.cpp:10:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double im;
^
prog.cpp:10:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double im;
  ^
prog.cpp:10:7: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double im;
    ^
prog.cpp:10:10: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        double im;
      ^
prog.cpp:12:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    } Complex;
^
prog.cpp:12:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    } Complex;
  ^
prog.cpp:14:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    const Complex c = {46} ;
^
prog.cpp:14:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    const Complex c = {46} ;
  ^
prog.cpp:16:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    c.im= 59;
^
prog.cpp:16:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    c.im= 59;
  ^
prog.cpp:16:11: error: cannot assign to variable 'c' with const-qualified type 'const Complex'
    c.im= 59;
    ~~~~^
prog.cpp:14:21: note: variable 'c' declared const here
    const Complex c = {46} ;
    ~~~~~~~~~~~~~~^~~~~~~~
prog.cpp:18:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    cout << c.re;
^
prog.cpp:18:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    cout << c.re;
  ^
prog.cpp:18:7: error: use of undeclared identifier 'cout'; did you mean 'std::cout'?
    cout << c.re;
    ^~~~
    std::cout
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/iostream:61:18: note: 'std::cout' declared here
  extern ostream cout;          /// Linked to standard output
                 ^
prog.cpp:20:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    return 0;
^
prog.cpp:20:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    return 0;
  ^
20 warnings and 2 errors generated.
stdout
Standard output is empty