This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/10690 (template-id in typeid)


Just another case where we can use resolve_nondeduced_context to resolve a template-id to a unique function.

Tested x86_64-pc-linux-gnu, applied to trunk.
commit 8acfee2f7a5ca935e43342ede247232cfcff136e
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Nov 25 21:17:22 2009 -0500

    	PR c++/10690
    	* rtti.c (get_tinfo_decl_dynamic): Call resolve_nondeduced_context.

diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index e96abcb..383c96c 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -245,6 +245,8 @@ get_tinfo_decl_dynamic (tree exp)
   if (error_operand_p (exp))
     return error_mark_node;
 
+  exp = resolve_nondeduced_context (exp);
+
   /* peel back references, so they match.  */
   type = non_reference (TREE_TYPE (exp));
 
diff --git a/gcc/testsuite/g++.dg/template/explicit-args2.C b/gcc/testsuite/g++.dg/template/explicit-args2.C
index cd53b45..d37b734 100644
--- a/gcc/testsuite/g++.dg/template/explicit-args2.C
+++ b/gcc/testsuite/g++.dg/template/explicit-args2.C
@@ -1,6 +1,8 @@
 // PR c++/37177
 // { dg-options -std=c++0x }
 
+#include <typeinfo>
+
 namespace N1
 {
   template<class T> bool foo();
@@ -21,18 +23,22 @@ int main()
 {
   (void)(&S::bar<int>);
   decltype(&S::bar<int>) a;
+  typeid(&S::bar<int>);
 
   (void*)(&S::foo<int>);
   (void)(&S::foo<int>);
   decltype(&S::foo<int>) b;
+  typeid(&S::foo<int>);
 
   (void*)(&N1::foo<int>);
   (void)(&N1::foo<int>);
   decltype(&N1::foo<int>) c;
+  typeid(&N1::foo<int>);
 
   (void*)(&foo<int>);
   (void)(&foo<int>);
   decltype(&foo<int>) d;
+  typeid(&foo<int>);
 
   &foo<int> == 0;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]