re PR c++/42277 (decltype error in template)
PR c++/42277 * semantics.c (finish_decltype_type): Don't assume that op1 of a COMPONENT_REF is always the field. * g++.dg/cpp0x/decltype20.C: New. From-SVN: r155002
This commit is contained in:
parent
2f2d73866b
commit
21920fd14c
4 changed files with 28 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-12-04 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42277
|
||||
* semantics.c (finish_decltype_type): Defer handling of decltype
|
||||
of a non-dependent COMPONENT_REF in a template.
|
||||
|
||||
2009-12-04 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/42218
|
||||
|
|
|
@ -4777,7 +4777,13 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p)
|
|||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (type_dependent_expression_p (expr))
|
||||
if (type_dependent_expression_p (expr)
|
||||
/* In a template, a COMPONENT_REF has an IDENTIFIER_NODE for op1 even
|
||||
if it isn't dependent, so that we can check access control at
|
||||
instantiation time, so defer the decltype as well (PR 42277). */
|
||||
|| (id_expression_or_member_access_p
|
||||
&& processing_template_decl
|
||||
&& TREE_CODE (expr) == COMPONENT_REF))
|
||||
{
|
||||
if (id_expression_or_member_access_p)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-12-04 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42277
|
||||
* g++.dg/cpp0x/decltype20.C: New.
|
||||
|
||||
2009-12-04 David Daney <ddaney@caviumnetworks.com>
|
||||
|
||||
PR rtl-optimization/42164
|
||||
|
|
10
gcc/testsuite/g++.dg/cpp0x/decltype20.C
Normal file
10
gcc/testsuite/g++.dg/cpp0x/decltype20.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
// PR c++/42277
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
struct S { int s; };
|
||||
template <int N>
|
||||
void foo ()
|
||||
{
|
||||
S s;
|
||||
decltype (s.s) i;
|
||||
}
|
Loading…
Add table
Reference in a new issue