Commit 20309c6e by Paolo Carlini Committed by Paolo Carlini

re PR c++/70466 ([ICE on invalid code in tree check: expected constructor, have…

re PR c++/70466 ([ICE on invalid code in tree check: expected constructor, have parm_decl in convert_like_real, at cp/call.c:6371 with -std=c++11)

/cp
2016-05-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70466
	* call.c (convert_like_real): Check that we are actually converting
	from an init list.

/testsuite
2016-05-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70466
	* g++.dg/template/pr70466-1.C: New.
	* g++.dg/template/pr70466-2.C: Likewise.

From-SVN: r236395
parent 50c78b9a
2016-05-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70466
* call.c (convert_like_real): Check that we are actually converting
from an init list.
2016-05-16 Matthew Wahab <matthew.wahab@arm.com> 2016-05-16 Matthew Wahab <matthew.wahab@arm.com>
* decl.c (grokdeclarator): Remove errmsg and use of * decl.c (grokdeclarator): Remove errmsg and use of
......
...@@ -6377,8 +6377,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, ...@@ -6377,8 +6377,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
/* When converting from an init list we consider explicit /* When converting from an init list we consider explicit
constructors, but actually trying to call one is an error. */ constructors, but actually trying to call one is an error. */
if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn) if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn)
&& BRACE_ENCLOSED_INITIALIZER_P (expr)
/* Unless this is for direct-list-initialization. */ /* Unless this is for direct-list-initialization. */
&& !DIRECT_LIST_INIT_P (expr) && !CONSTRUCTOR_IS_DIRECT_INIT (expr)
/* And in C++98 a default constructor can't be explicit. */ /* And in C++98 a default constructor can't be explicit. */
&& cxx_dialect >= cxx11) && cxx_dialect >= cxx11)
{ {
......
2016-05-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70466
* g++.dg/template/pr70466-1.C: New.
* g++.dg/template/pr70466-2.C: Likewise.
2016-05-18 Michael Meissner <meissner@linux.vnet.ibm.com> 2016-05-18 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/p9-splat-1.c: New tests for ISA 3.0 word * gcc.target/powerpc/p9-splat-1.c: New tests for ISA 3.0 word
......
// PR c++/70466
template < class T, class T > // { dg-error "conflicting" }
class A
{
public:
explicit A (T (S::*f) ()) {} // { dg-error "expected" }
};
template < class T, class S >
A < T, S > foo (T (S::*f) ())
{
return A < T, S > (f);
}
class B
{
public:
void bar () {}
};
int
main ()
{
foo (&B::bar);
return 0;
}
// PR c++/70466
template < class T, class S >
struct A
{
explicit A (...) {}
};
template < class T, class S >
A < T, S > foo (T (S::*f) ())
{
return A < T, S > (f);
}
struct B
{
void bar () {}
};
int
main ()
{
foo (&B::bar);
return 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