public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Stephan Bergmann <sbergman@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: Jason Merrill <jason@redhat.com>
Subject: Re: [pushed] c++: build initializer_list<string> in a loop [PR105838]
Date: Tue, 13 Dec 2022 15:07:51 +0100	[thread overview]
Message-ID: <4d3f484e-04f9-b270-0fe7-0f44a6f861d5@redhat.com> (raw)
In-Reply-To: <20221208184528.1657376-1-jason@redhat.com>

On 08/12/2022 19:45, Jason Merrill via Gcc-patches wrote:
> Tested x86_64-pc-linux-gnu, applying to trunk.

Bisecting shows this started to break

> $ cat test.cc
> #include <initializer_list>
> template<typename> struct ConstCharArrayDetector;
> template<int N> struct ConstCharArrayDetector<char const[N]> { using Type = int; };
> struct OUString {
>     template<typename T> OUString(T &, typename ConstCharArrayDetector<T>::Type = 0);
> };
> struct Sequence { Sequence(std::initializer_list<OUString>); };
> Sequence f() { return {""}; }

> $ g++ -fsyntax-only test.cc
> test.cc: In function ‘Sequence f()’:
> test.cc:8:26: error: no matching function for call to ‘OUString::OUString(const char* const)’
>     8 | Sequence f() { return {""}; }
>       |                          ^
> test.cc:5:26: note: candidate: ‘template<class T> OUString::OUString(T&, typename ConstCharArrayDetector<T>::Type)’
>     5 |     template<typename T> OUString(T &, typename ConstCharArrayDetector<T>::Type = 0);
>       |                          ^~~~~~~~
> test.cc:5:26: note:   template argument deduction/substitution failed:
> test.cc: In substitution of ‘template<class T> OUString::OUString(T&, typename ConstCharArrayDetector<T>::Type) [with T = const char* const]’:
> test.cc:8:26:   required from here
> test.cc:5:26: error: invalid use of incomplete type ‘struct ConstCharArrayDetector<const char* const>’
> test.cc:2:27: note: declaration of ‘struct ConstCharArrayDetector<const char* const>’
>     2 | template<typename> struct ConstCharArrayDetector;
>       |                           ^~~~~~~~~~~~~~~~~~~~~~
> test.cc:4:8: note: candidate: ‘constexpr OUString::OUString(const OUString&)’
>     4 | struct OUString {
>       |        ^~~~~~~~
> test.cc:4:8: note:   no known conversion for argument 1 from ‘const char* const’ to ‘const OUString&’
> test.cc:4:8: note: candidate: ‘constexpr OUString::OUString(OUString&&)’
> test.cc:4:8: note:   no known conversion for argument 1 from ‘const char* const’ to ‘OUString&&’
> test.cc:8:26: error: conversion from ‘const char* const’ to non-scalar type ‘const OUString’ requested
>     8 | Sequence f() { return {""}; }
>       |                          ^


  reply	other threads:[~2022-12-13 14:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 18:45 Jason Merrill
2022-12-13 14:07 ` Stephan Bergmann [this message]
2023-06-12  8:56 Jason Merrill

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=4d3f484e-04f9-b270-0fe7-0f44a6f861d5@redhat.com \
    --to=sbergman@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).