public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112354] New: mismatched types 'B<T>' and 'B<int>&' for generic lambda noexcept-specifier referencing enclosing function parameter
@ 2023-11-02 18:24 ed at catmur dot uk
  2023-11-02 18:33 ` [Bug c++/112354] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ed at catmur dot uk @ 2023-11-02 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112354
           Summary: mismatched types 'B<T>' and 'B<int>&' for generic
                    lambda noexcept-specifier referencing enclosing
                    function parameter
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

Since 4.9.0,

template<class>
struct B {
    B();
    B(B const&);
};
template<class T> void g(B<T>, int);
auto f(B<int> x) {
    return [](auto y) noexcept(noexcept(g(x, y))) {
        return 1;
    };
}
int i = f({})(0);

fails with:

<source>: In instantiation of 'f(B<int>)::<lambda(auto:1)> [with auto:1 =
int]':
<source>:12:14:   required from here
   12 | int i = f({})(0);
      |         ~~~~~^~~
<source>:8:42: error: no matching function for call to 'g(B<int>&&, int&)'
    8 |     return [](auto y) noexcept(noexcept(g(x, y))) {
      |                                         ~^~~~~~
<source>:6:24: note: candidate: 'template<class T> void g(B<T>, int)'
    6 | template<class T> void g(B<T>, int);
      |                        ^
<source>:6:24: note:   template argument deduction/substitution failed:
<source>:8:42: note:   mismatched types 'B<T>' and 'B<int>&'
    8 |     return [](auto y) noexcept(noexcept(g(x, y))) {
      |                                         ~^~~~~~

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/112354] mismatched types 'B<T>' and 'B<int>&' for generic lambda noexcept-specifier referencing enclosing function parameter
  2023-11-02 18:24 [Bug c++/112354] New: mismatched types 'B<T>' and 'B<int>&' for generic lambda noexcept-specifier referencing enclosing function parameter ed at catmur dot uk
@ 2023-11-02 18:33 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-02 18:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-11-02
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-02 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 18:24 [Bug c++/112354] New: mismatched types 'B<T>' and 'B<int>&' for generic lambda noexcept-specifier referencing enclosing function parameter ed at catmur dot uk
2023-11-02 18:33 ` [Bug c++/112354] " pinskia at gcc dot gnu.org

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).