]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: non-template friend of template [PR106740]
authorJason Merrill <jason@redhat.com>
Mon, 8 May 2023 22:22:30 +0000 (18:22 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 9 May 2023 03:51:47 +0000 (23:51 -0400)
This was fixed by r13-1018, but the testcase seems needed.

PR c++/106740

gcc/testsuite/ChangeLog:

* g++.dg/template/friend78.C: New test.

gcc/testsuite/g++.dg/template/friend78.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/template/friend78.C b/gcc/testsuite/g++.dg/template/friend78.C
new file mode 100644 (file)
index 0000000..6100528
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/106740
+// { dg-additional-options -Wno-non-template-friend }
+
+template <typename> struct EnumClass { friend int toString(EnumClass); };
+struct AmhsConvInfoCoFw {
+  enum AftnTypeXMsgTypeEnum {};
+  typedef EnumClass<AftnTypeXMsgTypeEnum> 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);