From: Jason Merrill Date: Mon, 8 May 2023 22:22:30 +0000 (-0400) Subject: c++: non-template friend of template [PR106740] X-Git-Tag: basepoints/gcc-15~9548 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73f7109ffb159302e9d8f70948a5b43b046b38bc;p=thirdparty%2Fgcc.git c++: non-template friend of template [PR106740] This was fixed by r13-1018, but the testcase seems needed. PR c++/106740 gcc/testsuite/ChangeLog: * g++.dg/template/friend78.C: New test. --- diff --git a/gcc/testsuite/g++.dg/template/friend78.C b/gcc/testsuite/g++.dg/template/friend78.C new file mode 100644 index 000000000000..6100528468e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend78.C @@ -0,0 +1,18 @@ +// PR c++/106740 +// { dg-additional-options -Wno-non-template-friend } + +template struct EnumClass { friend int toString(EnumClass); }; +struct AmhsConvInfoCoFw { + enum AftnTypeXMsgTypeEnum {}; + typedef EnumClass AftnTypeXMsgType; + const int getAftnTypeXMsgTypeAsStr() const; + struct MtcuAxgwInfo { + AftnTypeXMsgType mAftnTypeXMsgType; + }; +}; +const int AmhsConvInfoCoFw::getAftnTypeXMsgTypeAsStr() const { + MtcuAxgwInfo __trans_tmp_1; + toString(__trans_tmp_1.mAftnTypeXMsgType); + return 0; +} +int toString(AmhsConvInfoCoFw::AftnTypeXMsgType);