summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/modules/internal-16.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/modules/internal-16.C')
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-16.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/modules/internal-16.C b/gcc/testsuite/g++.dg/modules/internal-16.C
new file mode 100644
index 00000000000..4a928ae801b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/internal-16.C
@@ -0,0 +1,30 @@
+// PR c++/122253
+// { dg-additional-options "-fmodules -Wtemplate-names-tu-local" }
+
+export module M;
+
+template <int> struct ic {};
+struct S {
+ constexpr operator int() const { return 5; }
+ constexpr int operator&() const { return 8; }
+};
+
+template <typename T> inline void a(T) {
+ T a;
+ static T b;
+ ic<a>{};
+ ic<b>{};
+ ic<&a>{};
+ ic<&b>{};
+}
+
+template <typename T> inline auto b(T x) {
+ return [&](auto y) {
+ return [=](auto z) {
+ return ic<(int)x + (int)&y + (int)z>{};
+ };
+ };
+}
+
+template void a(S);
+ic<5 + 8 + 5> x = b(S{})(S{})(S{});