]> git.tdb.fi Git - ext/sigc++-2.0.git/blob - tools/gcc_template_specialization_operator_overload.cc
Adjust the name of the library to match upstream
[ext/sigc++-2.0.git] / tools / gcc_template_specialization_operator_overload.cc
1 // Configuration-time test program, used in Meson build.
2 // Corresponds to the M4 macro SIGC_CXX_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD.
3
4 #include <iostream>
5
6 class Thing
7 {
8   public:
9   Thing()
10   {}
11
12   template <class T>
13   void operator()(T a, T b)
14   {
15     T c = a + b;
16     std::cout << c << std::endl;
17   }
18 };
19
20 template<class T2>
21 class OtherThing
22 {
23 public:
24   void do_something()
25   {
26      Thing thing_;
27      thing_.template operator()<T2>(1, 2);
28      //This fails with or without the template keyword, on SUN Forte C++ 5.3, 5.4, and 5.5:
29   }
30 };
31
32 int main()
33 {
34   OtherThing<int> thing;
35   thing.do_something();
36   return 0;
37 }