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'.
/* 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
--- /dev/null
+// 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 >;