#include <iostream> int main() { typedef union Complex { double re; double im; } Complex; const Complex c = {46} ; c.im= 59; cout << c.re; return 0; }
Standard input is empty
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.
Standard output is empty