https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81167

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Minimal reproducer:

$ cat ../../src/pr81167.C
struct bar;

struct foo
{
  foo () {}
  foo (const bar &) {}
};

struct bar
{
  operator foo() && { return foo (); }
};

void test ()
{
  foo f = bar ();
}

$ ./xg++ -B. ../../src/pr81167.C  -Wconversion
../../src/pr81167.C: In function ‘void test()’:
../../src/pr81167.C:16:16: warning: choosing ‘bar::operator foo() &&’ over
‘foo::foo(const bar&)’ [-Wconversion]
   foo f = bar ();
                ^
‘
in deferred_printed_type, at cp/error.c:118
0x908c9e deferred_printed_type::deferred_printed_type(tree_node*, char const**,
bool, bool)
        ../../src/gcc/cp/error.c:118
0x907de4 defer_phase_2_of_type_diff
        ../../src/gcc/cp/error.c:3985
0x9083a1 cp_printer
        ../../src/gcc/cp/error.c:4062
0x1acf511 pp_format(pretty_printer*, text_info*)
        ../../src/gcc/pretty-print.c:679
0x1ab722a diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../src/gcc/diagnostic.c:974
0x1ab77a0 diagnostic_impl
        ../../src/gcc/diagnostic.c:1099
0x1ab7cef warning(int, char const*, ...)
        ../../src/gcc/diagnostic.c:1187
0x7edc64 joust
        ../../src/gcc/cp/call.c:10076
0x7e267a build_over_call
        ../../src/gcc/cp/call.c:7623
0x7dee82 convert_like_real
        ../../src/gcc/cp/call.c:6757
0x7dfa4a convert_like_real
        ../../src/gcc/cp/call.c:6873
0x7d4010 build_user_type_conversion(tree_node*, tree_node*, int, int)
        ../../src/gcc/cp/call.c:3995
0x870c39 ocp_convert(tree_node*, tree_node*, int, int, int)
        ../../src/gcc/cp/cvt.c:889
0x918775 expand_default_init
        ../../src/gcc/cp/init.c:1789
0x9193f5 expand_aggr_init_1
        ../../src/gcc/cp/init.c:1968
0x917fa1 build_aggr_init(tree_node*, tree_node*, int, int)
        ../../src/gcc/cp/init.c:1706
0x8a12df build_aggr_init_full_exprs
        ../../src/gcc/cp/decl.c:6128
0x8a21ff check_initializer
        ../../src/gcc/cp/decl.c:6276
0x8a5df7 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../src/gcc/cp/decl.c:6995
0x9a9b16 cp_parser_init_declarator
        ../../src/gcc/cp/parser.c:19393
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to