This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix PR 9459
- From: Kriang Lerdsuwanakij <lerdsuwa at users dot sourceforge dot net>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Feb 2003 00:23:28 +0700 (ICT)
- Subject: [C++ PATCH] Fix PR 9459
- Reply-to: <lerdsuwa at users dot sourceforge dot net>
Hi
This patch adds TYPEOF_TYPE handling to dump_type_prefix/suffix
rather than displaying 'sorry, unimplemented ...' messages.
Tested on i686-pc-linux-gnu. Commited to main trunk as obvious.
--Kriang
2003-02-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/9459
* error.c (dump_type_prefix): Handle TYPEOF_TYPE.
(dump_type_suffix): Likewise.
2003-02-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/9459
* g++.dg/ext/typeof4.C: New test.
diff -cprN gcc-main-save/gcc/cp/error.c gcc-main-new/gcc/cp/error.c
*** gcc-main-save/gcc/cp/error.c Thu Jan 30 21:19:09 2003
--- gcc-main-new/gcc/cp/error.c Sun Feb 16 22:41:53 2003
*************** dump_type_prefix (t, flags)
*** 687,692 ****
--- 687,693 ----
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
+ case TYPEOF_TYPE:
dump_type (t, flags);
padding = before;
break;
*************** dump_type_suffix (t, flags)
*** 783,788 ****
--- 784,790 ----
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
+ case TYPEOF_TYPE:
break;
default:
diff -cprN gcc-main-save/gcc/testsuite/g++.dg/ext/typeof4.C gcc-main-new/gcc/testsuite/g++.dg/ext/typeof4.C
*** gcc-main-save/gcc/testsuite/g++.dg/ext/typeof4.C Thu Jan 1 07:00:00 1970
--- gcc-main-new/gcc/testsuite/g++.dg/ext/typeof4.C Sun Feb 16 23:08:51 2003
***************
*** 0 ****
--- 1,13 ----
+ // { dg-do compile }
+ // { dg-options "" }
+
+ // Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+ // PR c++/9459: typeof in return type of template function
+
+ void foo (int) {}
+ void foo (double) {}
+
+ template <typename C>
+ typeof(foo(1))
+ bar () { return foo(1); }