Commit 6780e186 by Jason Merrill Committed by Jason Merrill

re PR c++/10690 ([DR 115] Even when used within typeid(), a template-id…

re PR c++/10690 ([DR 115] Even when used within typeid(), a template-id generating an overload set with only one function should silently decay to a pointer to function)

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

From-SVN: r154675
parent 87cd4259
2009-11-25 Jason Merrill <jason@redhat.com>
PR c++/10690
* rtti.c (get_tinfo_decl_dynamic): Call resolve_nondeduced_context.
2009-11-24 Jason Merrill <jason@redhat.com> 2009-11-24 Jason Merrill <jason@redhat.com>
PR c++/42137 PR c++/42137
......
...@@ -245,6 +245,8 @@ get_tinfo_decl_dynamic (tree exp) ...@@ -245,6 +245,8 @@ get_tinfo_decl_dynamic (tree exp)
if (error_operand_p (exp)) if (error_operand_p (exp))
return error_mark_node; return error_mark_node;
exp = resolve_nondeduced_context (exp);
/* peel back references, so they match. */ /* peel back references, so they match. */
type = non_reference (TREE_TYPE (exp)); type = non_reference (TREE_TYPE (exp));
......
// PR c++/37177 // PR c++/37177
// { dg-options -std=c++0x } // { dg-options -std=c++0x }
#include <typeinfo>
namespace N1 namespace N1
{ {
template<class T> bool foo(); template<class T> bool foo();
...@@ -21,18 +23,22 @@ int main() ...@@ -21,18 +23,22 @@ int main()
{ {
(void)(&S::bar<int>); (void)(&S::bar<int>);
decltype(&S::bar<int>) a; decltype(&S::bar<int>) a;
typeid(&S::bar<int>);
(void*)(&S::foo<int>); (void*)(&S::foo<int>);
(void)(&S::foo<int>); (void)(&S::foo<int>);
decltype(&S::foo<int>) b; decltype(&S::foo<int>) b;
typeid(&S::foo<int>);
(void*)(&N1::foo<int>); (void*)(&N1::foo<int>);
(void)(&N1::foo<int>); (void)(&N1::foo<int>);
decltype(&N1::foo<int>) c; decltype(&N1::foo<int>) c;
typeid(&N1::foo<int>);
(void*)(&foo<int>); (void*)(&foo<int>);
(void)(&foo<int>); (void)(&foo<int>);
decltype(&foo<int>) d; decltype(&foo<int>) d;
typeid(&foo<int>);
&foo<int> == 0; &foo<int> == 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment