https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97174
Bug ID: 97174 Summary: out-of-namespace function definition Product: gcc Version: 7.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wolfgang.roe...@gi-de.com Target Milestone: --- Hi, I would like to post a bug report for the GNU C/C++ compiler 7.5.0. We use the compiler to generate code for a PowerPC processor. Invokation line for the GNU C++ compiler: ccppc -c -x c++ --std=gnu++17 -Wall -Werror -g -mcpu=e6500 -m32 -maltivec -mvrsave -ftls-model=local-exec -msdata=sysv -fno-common -fno-openmp -mbig -mmultiple -mno-string -misel -mstrict-align -fverbose-asm -G 8 -O3 -I<some include paths> -D<some #define's> X.CPP -oX.O // file X.CPP #include <type_traits> namespace N { template <typename T> typename std::make_unsigned_t<T> conv (T); } template <typename T> long N::conv (T val) { return static_cast<long>(val); } The compiler accepts this code even though function "long N::conv (T)" is not declared in namespace N. I think this is an illegal out-of-namespace definition (cf. C++17 standard, 10.3.1.2/2). With kind regards W. Roehrl