Commit d37c775a by Jason Merrill Committed by Jason Merrill

re PR c++/53484 ([c++11] Wrong auto in lambdas in function templates)

	PR c++/53484
	* pt.c (do_auto_deduction): Don't try to deduce from a
	type-dependent initializer.

From-SVN: r188116
parent 676bd9a4
2012-06-01 Jason Merrill <jason@redhat.com>
PR c++/53484
* pt.c (do_auto_deduction): Don't try to deduce from a
type-dependent initializer.
2012-06-01 Paolo Carlini <paolo.carlini@oracle.com> 2012-06-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/26155 PR c++/26155
......
...@@ -20318,10 +20318,9 @@ do_auto_deduction (tree type, tree init, tree auto_node) ...@@ -20318,10 +20318,9 @@ do_auto_deduction (tree type, tree init, tree auto_node)
if (init == error_mark_node) if (init == error_mark_node)
return error_mark_node; return error_mark_node;
if (processing_template_decl if (type_dependent_expression_p (init))
&& (TREE_TYPE (init) == NULL_TREE /* Defining a subset of type-dependent expressions that we can deduce
|| BRACE_ENCLOSED_INITIALIZER_P (init))) from ahead of time isn't worth the trouble. */
/* Not enough information to try this yet. */
return type; return type;
/* [dcl.spec.auto]: Obtain P from T by replacing the occurrences of auto /* [dcl.spec.auto]: Obtain P from T by replacing the occurrences of auto
......
2012-06-01 Jason Merrill <jason@redhat.com>
PR c++/53484
* g++.dg/cpp0x/auto33.C: New.
2012-06-01 Paolo Carlini <paolo.carlini@oracle.com> 2012-06-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/26155 PR c++/26155
......
// PR c++/53484
// { dg-do compile { target c++11 } }
template<class T,class U> struct ST;
template<class T> struct ST<T,T> {};
template <class T>
void f(T x){
[&]{
auto y = x;
ST<decltype(y),int>();
}();
}
int main(){ f(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