This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61465] Bogus parameter set but not used warning in constructor initialization list


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For:
struct Foo {
  Foo(void* x) : y{static_cast<char*>(x)} {}
  char* y;
};
struct Bar {
  Bar(void* x) : y(static_cast<char*>(x)) {}
  char* y;
};
the x parameter in Bar ctor is marked through:

#0  mark_exp_read (exp=<parm_decl 0x7ffff19fe380 x>) at ../../gcc/cp/expr.c:135
#1  0x000000000067af84 in mark_exp_read (exp=<nop_expr 0x7ffff19fc5c0>) at
../../gcc/cp/expr.c:146
#2  0x000000000067aea6 in mark_rvalue_use (expr=<nop_expr 0x7ffff19fc5c0>) at
../../gcc/cp/expr.c:99
#3  0x0000000000623e29 in convert_like_real (convs=0x20d65a0, expr=<nop_expr
0x7ffff19fc5c0>, fn=<tree 0x0>, argnum=0, inner=0, 
    issue_conversion_warnings=true, c_cast_p=false, complain=3) at
../../gcc/cp/call.c:6209
#4  0x0000000000630bd3 in perform_implicit_conversion_flags (type=<pointer_type
0x7ffff18d19d8>, expr=<nop_expr 0x7ffff19fc5c0>, complain=3, 
    flags=1) at ../../gcc/cp/call.c:9315
#5  0x00000000007bb105 in convert_for_assignment (type=<pointer_type
0x7ffff18d19d8>, rhs=<nop_expr 0x7ffff19fc5c0>, errtype=ICR_INIT, 
    fndecl=<tree 0x0>, parmnum=0, complain=3, flags=1) at
../../gcc/cp/typeck.c:8233
#6  0x00000000007bb65f in convert_for_initialization (exp=<component_ref
0x7ffff19a1990>, type=<pointer_type 0x7ffff18d19d8>, 
    rhs=<nop_expr 0x7ffff19fc5c0>, flags=1, errtype=ICR_INIT, fndecl=<tree
0x0>, parmnum=0, complain=3) at ../../gcc/cp/typeck.c:8324
#7  0x00000000007b933d in cp_build_modify_expr (lhs=<component_ref
0x7ffff19a1990>, modifycode=INIT_EXPR, rhs=<nop_expr 0x7ffff19fc5c0>, 
    complain=3) at ../../gcc/cp/typeck.c:7593
#8  0x00000000007ced80 in perform_member_init (member=<field_decl
0x7ffff19ee7b8 y>, init=<nop_expr 0x7ffff19fc5c0>) at ../../gcc/cp/init.c:771
#9  0x00000000007d0535 in emit_mem_initializers (mem_inits=<tree_list
0x7ffff1a00190>) at ../../gcc/cp/init.c:1136
#10 0x00000000007f895c in finish_mem_initializers (mem_inits=<tree_list
0x7ffff1a00168>) at ../../gcc/cp/semantics.c:1603
#11 0x0000000000767fa0 in cp_parser_mem_initializer_list
(parser=0x7ffff19fe000) at ../../gcc/cp/parser.c:12530
#12 0x0000000000767b21 in cp_parser_ctor_initializer_opt
(parser=0x7ffff19fe000) at ../../gcc/cp/parser.c:12441
#13 0x000000000077311c in cp_parser_ctor_initializer_opt_and_function_body
(parser=0x7ffff19fe000, in_function_try_block=false)
    at ../../gcc/cp/parser.c:18993
#14 0x000000000077adce in cp_parser_function_definition_after_declarator
(parser=0x7ffff19fe000, inline_p=true) at ../../gcc/cp/parser.c:23173
#15 0x000000000077cc6a in cp_parser_late_parsing_for_member
(parser=0x7ffff19fe000, member_function=<function_decl 0x7ffff19f1870 Bar>)
    at ../../gcc/cp/parser.c:23856

No idea what different code path is used for the {} initialization as opposed
to (), but supposedly somewhere in there we should call mark_rvalue_use or
mark_exp_read.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]