https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88341
Bug ID: 88341 Summary: taking norm() of complex variable fails to compile with -std=c++11 Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: p.vanhoof at oma dot be Target Milestone: --- Created attachment 45145 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45145&action=edit preprocessed file The attached code fails to compile with the mainline at r266725. % g++ -std=c++11 -W -Wall -c bug.cc In file included from bug.cc:1: /usr/local/gcc900/include/c++/9.0.0/complex: In instantiation of ‘static constexpr _Tp std::_Norm_helper<true>::_S_do_it(const std::complex<_Tp>&) [with _Tp = double]’: /usr/local/gcc900/include/c++/9.0.0/complex:689:35: required from ‘_Tp std::norm(const std::complex<_Tp>&) [with _Tp = double]’ bug.cc:5:20: required from here /usr/local/gcc900/include/c++/9.0.0/complex:681:9: error: body of ‘constexpr’ function ‘static constexpr _Tp std::_Norm_helper<true>::_S_do_it(const std::complex<_Tp>&) [with _Tp = double]’ not a return-statement 681 | } | ^ % cat bug.cc #include <complex> double n(std::complex<double>& c) { return std::norm(c); } The code compiles correctly with all release versions I tried, including 8.2.0, so this is a regression from g++ 8. % g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/gcc900/lib/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-mainline/configure --prefix=/usr/local/gcc900 --enable-languages=c,c++,fortran Thread model: posix gcc version 9.0.0 20181202 (experimental) (GCC)