Language
C++
Compiler
gcc 12.1.0
Options
Warnings
Optimization
Boost 1.79.0
C++11
-pedantic
$ g++ prog.cc -Wall -Wextra -O2 -march=native -I/opt/wandbox/boost-1.79.0-gcc-12.1.0/include -std=c++11 -pedantic
Exit Code:
1
Author
anonymous
almost 3 years ago
C++
gcc 12.1.0
Author
anonymous
almost 3 years ago
$ g++ prog.cc -Wall -Wextra -O2 -march=native -I/opt/wandbox/boost-1.79.0-gcc-12.1.0/include -std=c++11 -pedantic
prog.cc: In function 'void testTemplateConstructor()':
prog.cc:42:27: error: cannot bind non-const lvalue reference of type 'complex<double>&' to an rvalue of type 'complex<double>'
42 | complex<double> cd = cf;
| ^~
prog.cc:26:25: note: initializing argument 1 of 'complex<T>::complex(complex<T>&) [with T = double]'
26 | complex(complex<T>& comp){
| ~~~~~~~~~~~~^~~~
prog.cc:32:6: note: after user-defined conversion: 'complex<T>::complex(complex<X>&) [with X = float; T = double]'
32 | complex(complex<X>& arg) {
| ^~~~~~~
prog.cc:42:22: warning: unused variable 'cd' [-Wunused-variable]
42 | complex<double> cd = cf;
| ^~