[Bug c++/97174] New: out-of-namespace function definition
wolfgang.roehrl@gi-de.com
gcc-bugzilla@gcc.gnu.org
Wed Sep 23 07:43:23 GMT 2020
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.roehrl@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
More information about the Gcc-bugs
mailing list