Commit 1c9a0251 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/81167 (ICE on valid C++ code in deferred_printed_type, at cp/error.c:118)

	PR c++/81167
	* call.c (joust): Use TREE_TYPE (source) if source is
	a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).

	* g++.dg/cpp0x/pr81167.C: New test.

From-SVN: r256905
parent 26fc730d
2018-01-19 Jakub Jelinek <jakub@redhat.com> 2018-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/81167
* call.c (joust): Use TREE_TYPE (source) if source is
a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
PR c++/83919 PR c++/83919
* typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
for direct enum init. for direct enum init.
......
...@@ -10090,7 +10090,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, ...@@ -10090,7 +10090,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
else if (warn) else if (warn)
{ {
tree source = source_type (w->convs[0]); tree source = source_type (w->convs[0]);
if (! DECL_CONSTRUCTOR_P (w->fn)) if (POINTER_TYPE_P (source))
source = TREE_TYPE (source); source = TREE_TYPE (source);
if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn) if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn)
&& warning (OPT_Wconversion, " for conversion from %qH to %qI", && warning (OPT_Wconversion, " for conversion from %qH to %qI",
......
2018-01-19 Jakub Jelinek <jakub@redhat.com> 2018-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/81167
* g++.dg/cpp0x/pr81167.C: New test.
PR c++/83919 PR c++/83919
* g++.dg/cpp0x/pr83919.C: New test. * g++.dg/cpp0x/pr83919.C: New test.
......
// PR c++/81167
// { dg-do compile { target c++11 } }
// { dg-options "-Wconversion" }
struct bar;
struct foo
{
foo () {}
foo (const bar &) {}
};
struct bar
{
operator foo () && { return foo (); }
};
void test ()
{
foo f = bar ();
// { dg-warning "choosing 'bar::operator foo\\(\\) &&' over 'foo::foo\\(const bar&\\)'" "" { target *-*-* } .-1 }
// { dg-warning "for conversion from 'bar' to 'foo'" "" { target *-*-* } .-2 }
// { dg-message "because conversion sequence for the argument is better" "" { target *-*-* } .-3 }
}
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