This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
New C++ parser test
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: 29 Dec 2002 17:15:15 +0100
- Subject: New C++ parser test
- Organization: Integrable Solutions
This adds a new C++ parser test derived from C++/70.
-- Gaby
Index: g++.dg/overload/operator-star-1.C
===================================================================
RCS file: g++.dg/overload/operator-star-1.C
diff -N g++.dg/overload/operator-star-1.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- g++.dg/overload/operator-star-1.C 29 Dec 2002 16:12:01 -0000
***************
*** 0 ****
--- 1,27 ----
+ // Copyright (C) 2002 Free Software Foundation
+ // Origin: C++/70
+ // Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+ // { dg-do compile }
+
+ template <class T>
+ struct S;
+
+ template <class T>
+ void operator* (S<T>, S<T>);
+
+ template <class T>
+ struct S
+ {
+ friend void operator*<> (S, S); // { } // okay
+ void operator* (T) { }
+ };
+
+ template <class T>
+ void operator* (S<T>, S<T>) { }
+
+ int main()
+ {
+ S<int> s1, s2;
+ s1 * s2;
+ s1 * 2;
+ }