public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/110580] New: [14 Regression] gcc fails to typecheck nix-2.16.1 source: error: invalid initialization of reference of type
Date: Thu, 06 Jul 2023 21:46:50 +0000	[thread overview]
Message-ID: <bug-110580-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110580
           Summary: [14 Regression] gcc fails to typecheck nix-2.16.1
                    source: error: invalid initialization of reference of
                    type
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Created attachment 55495
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55495&action=edit
nar-accessor.cc.cc.xz

Originally observed the build failure on nix-2.16.1 source when building with
gcc r14-2344-g9f4f833455bb35.

I suspect it might be a form of https://gcc.gnu.org/PR110523 regression. But
filing just in case.

Attached unmodified preprocessed example.

The build succeeds on gcc-13:

$ g++-13 -c nar-accessor.cc.cc -std=c++2a
# ok

$ g++-14 -c nar-accessor.cc.cc -std=c++2a
nar-accessor.cc.cc: In instantiation of 'std::pair<typename std::_Rb_tree<_Key,
std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >,
_Compare, typename
__gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val>
>::other>::iterator, bool> std::map<_Key, _Tp, _Compare,
_Alloc>::emplace(_Args&& ...) [with _Args = {std::basic_string_view<char,
std::char_traits<char> >, nix::NarMember}; _Key =
std::__cxx11::basic_string<char>; _Tp = nix::NarMember; _Compare =
std::less<std::__cxx11::basic_string<char> >; _Alloc =
std::allocator<std::pair<const std::__cxx11::basic_string<char>,
nix::NarMember> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>,
std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename
__gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val>
>::other>::iterator = std::_Rb_tree_iterator<std::pair<const
std::__cxx11::basic_string<char>, nix::NarMember> >; typename
__gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val>
>::other = std::allocator<std::pair<const std::__cxx11::basic_string<char>,
nix::NarMember> >; typename
__gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> > =
__gnu_cxx::__alloc_traits<std::allocator<std::pair<const
std::__cxx11::basic_string<char>, nix::NarMember> >, std::pair<const
std::__cxx11::basic_string<char>, nix::NarMember> >::rebind<std::pair<const
std::__cxx11::basic_string<char>, nix::NarMember> >; typename
_Allocator::value_type = std::pair<const std::__cxx11::basic_string<char>,
nix::NarMember>]':
nar-accessor.cc.cc:126951:62:   required from here
nar-accessor.cc.cc:33745:23: error: invalid initialization of reference of type
'const std::map<std::__cxx11::basic_string<char>, nix::NarMember>::key_type&'
{aka 'const std::__cxx11::basic_string<char>&'} from expression of type
'std::basic_string_view<char>'
33745 |       const key_type& __k = __a;
      |                       ^~~

$ g++ -v |& unnix
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-14.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-14.0.0/libexec/gcc/x86_64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 99999999 (experimental) (GCC)

             reply	other threads:[~2023-07-06 21:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 21:46 slyfox at gcc dot gnu.org [this message]
2023-07-07  6:53 ` [Bug c++/110580] " rguenth at gcc dot gnu.org
2023-07-09  7:02 ` pinskia at gcc dot gnu.org
2023-07-09 15:56 ` pinskia at gcc dot gnu.org
2023-07-09 18:26 ` pinskia at gcc dot gnu.org
2023-07-09 18:37 ` pinskia at gcc dot gnu.org
2023-07-10  5:47 ` pinskia at gcc dot gnu.org
2023-07-10  5:53 ` pinskia at gcc dot gnu.org
2023-07-10 18:24 ` ppalka at gcc dot gnu.org
2023-07-11 14:06 ` cvs-commit at gcc dot gnu.org
2023-07-11 14:06 ` ppalka at gcc dot gnu.org
2023-07-11 19:02 ` slyfox at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110580-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).