From a2204f8fee67a62529f4f26d1e7cbbfbaf82e7f4 Mon Sep 17 00:00:00 2001 From: Daniel Kozak Date: Wed, 16 Mar 2016 22:10:44 +0100 Subject: [PATCH] Add tests for 15802 and 15372 --- test/compilable/test15802.d | 10 ++++++++++ test/runnable/cppa.d | 28 ++++++++++++++++++++++++++++ test/runnable/extra-files/cppb.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 test/compilable/test15802.d diff --git a/test/compilable/test15802.d b/test/compilable/test15802.d new file mode 100644 index 000000000000..9566eab6d9b6 --- /dev/null +++ b/test/compilable/test15802.d @@ -0,0 +1,10 @@ +extern(C++) { + template Foo(T) { + static int boo(); + } +} + +void main() +{ + string s = Foo!(int).boo.mangleof; +} diff --git a/test/runnable/cppa.d b/test/runnable/cppa.d index 80371a2edb0d..84cd4d186101 100644 --- a/test/runnable/cppa.d +++ b/test/runnable/cppa.d @@ -1084,6 +1084,31 @@ void test15610() c.f(); } +/****************************************/ +// 15372 + +extern(C++) int foo15372(T)(T v); + +void test15372() +{ + assert(foo15372!int(1) == 1); +} + +/****************************************/ +// 15802 + +extern(C++) { + template Foo15802(T) { + static int boo(T v); + } +} + +void test15802() +{ + assert(Foo15802!(int).boo(1) == 1); +} + + /****************************************/ void main() @@ -1123,6 +1148,9 @@ void main() testeh3(); test15579(); test15610(); + test15372(); + test15802(); + printf("Success\n"); } diff --git a/test/runnable/extra-files/cppb.cpp b/test/runnable/extra-files/cppb.cpp index 4ce847e90bd3..e948ad359613 100644 --- a/test/runnable/extra-files/cppb.cpp +++ b/test/runnable/extra-files/cppb.cpp @@ -695,4 +695,32 @@ void Derived2::f() } /******************************************/ +// 15372 +template +int foo15372(int value) +{ + return value; +} + +void test15372b() +{ + int t = foo15372(1); +} + +/****************************************/ +// 15802 +template +class Foo15802 +{ +public: + static int boo(int value) + { + return value; + } +}; + +void test15802b() +{ + int t = Foo15802::boo(1); +}