diff options
author | Jason Merrill <jason@redhat.com> | 2013-07-09 14:50:28 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-07-09 14:50:28 -0400 |
commit | ce9011004c1a2cdbfd6bb2b7e0003f73a3f21d69 (patch) | |
tree | 5a2ab3c4f0da441cea8d116b0a52b337f82adfd4 /gcc | |
parent | d9fac9dd59fa8f8d646c98d21f6c874f11e608b5 (diff) | |
download | gcc-ce9011004c1a2cdbfd6bb2b7e0003f73a3f21d69.zip gcc-ce9011004c1a2cdbfd6bb2b7e0003f73a3f21d69.tar.gz gcc-ce9011004c1a2cdbfd6bb2b7e0003f73a3f21d69.tar.bz2 |
re PR c++/57658 (ICE in tsubst_copy, at cp/pt.c:12213)
PR c++/57658
* semantics.c (finish_id_expression): Return the id for an
unevaluated outer variable.
From-SVN: r200845
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C | 19 |
3 files changed, 30 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9770f5b..88ba769 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-07-09 Jason Merrill <jason@redhat.com> + PR c++/57658 + * semantics.c (finish_id_expression): Return the id for an + unevaluated outer variable. + PR c++/57526 * semantics.c (lambda_capture_field_type): Build a DECLTYPE_TYPE if the variable type uses 'auto'. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index fd6c819..74a6a53 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3056,15 +3056,15 @@ finish_id_expression (tree id_expression, /* Disallow uses of local variables from containing functions, except within lambda-expressions. */ - if (!outer_var_p (decl) - /* It's not a use (3.2) if we're in an unevaluated context. */ - || cp_unevaluated_operand) - /* OK. */; - else if (TREE_STATIC (decl)) + if (!outer_var_p (decl)) + /* OK */; + else if (TREE_STATIC (decl) + /* It's not a use (3.2) if we're in an unevaluated context. */ + || cp_unevaluated_operand) { if (processing_template_decl) - /* For a use of an outer static var, return the identifier so - that we'll look it up again in the instantiation. */ + /* For a use of an outer static/unevaluated var, return the id + so that we'll look it up again in the instantiation. */ return id_expression; } else diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C new file mode 100644 index 0000000..635af97 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C @@ -0,0 +1,19 @@ +// PR c++/57568 +// { dg-require-effective-target c++11 } + +template < class T > +struct remove_reference +{ typedef int type; }; +template < class T > +class X +{ + enum Q { }; + bool f () + { + Q a; + [&a]{ + typename remove_reference < decltype (a) >::type t; + }; + } +}; +template class X< int >; |