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

Boris Kolpackov <boris at kolpackov dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris at kolpackov dot net

--- Comment #2 from Boris Kolpackov <boris at kolpackov dot net> ---
Here is a much shorter reproducer for seemingly the same problem. Note,
however, that here only GCC 16 issues the bogus warning, GCC 15 is silent.

#include <string>
#include <utility>

struct data
{
  const char* x;
};

struct common: data
{
  common (data&& d): data (std::move (d)) {}
};

struct link_rule: virtual common
{
  const std::string rule_id;

  link_rule (data&&);
};

link_rule::
link_rule (data&& d)
    : common (std::move (d)),
      rule_id (std::string (x) += ".link 3")
{
}

test.cxx: In constructor ‘link_rule::link_rule(data&&)’:
test.cxx:24:30: warning: ‘*<unknown>.data::x’ is used uninitialized
[-Wuninitialized]
   24 |       rule_id (std::string (x) += ".link 3")
      |

Reply via email to