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
This commit is contained in:
Jason Merrill 2009-11-26 10:59:52 -05:00 committed by Jason Merrill
parent 87cd42599c
commit 6780e186fc
3 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,8 @@
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>
PR c++/42137

View File

@ -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));

View File

@ -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;
}