public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58820] New: lambda multiple inheritance operator() not ambiguous
@ 2013-10-21  7:36 sutambe at yahoo dot com
  2013-10-21 12:18 ` [Bug c++/58820] " daniel.kruegler at googlemail dot com
  2021-08-27 20:47 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: sutambe at yahoo dot com @ 2013-10-21  7:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58820

            Bug ID: 58820
           Summary: lambda multiple inheritance operator() not ambiguous
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sutambe at yahoo dot com

The following lambda overloads are not ambiguous but they are reported as such.

template <class... Fs> 
struct overload_set : Fs...
{
  overload_set(Fs... f)
    : Fs(f)...
  {}  
};

template <class... Fs> 
overload_set<Fs...> overload(Fs... x)
{
  return overload_set<Fs...>(x...);
}

int main(void)
{
  double d = 10; 
  overload(
      [](int i)  { },
      [](double d)  { },
      [](char c) { } 
    )(d);
}


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

* [Bug c++/58820] lambda multiple inheritance operator() not ambiguous
  2013-10-21  7:36 [Bug c++/58820] New: lambda multiple inheritance operator() not ambiguous sutambe at yahoo dot com
@ 2013-10-21 12:18 ` daniel.kruegler at googlemail dot com
  2021-08-27 20:47 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-10-21 12:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58820

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
This looks like a more fundamental name lookup problem of gcc to me. It can be
reproduced with function object types that are no lambda closures:

template <class... Fs> 
struct overload_set : Fs...
{
  overload_set(Fs... f)
    : Fs(f)...
  {}  
};

template <class... Fs> 
overload_set<Fs...> overload(Fs... x)
{
  return overload_set<Fs...>(x...);
}

template<class T>
struct Closure 
{
  void operator()(T) const {}
  using FPtr = void(*)(T);
  operator FPtr() const;
};

int main()
{
  double d = 10; 
  overload(
      Closure<int>(),
      Closure<double>(),
      Closure<char>() 
    )(d);
}
>From gcc-bugs-return-432353-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Oct 21 12:22:52 2013
Return-Path: <gcc-bugs-return-432353-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19650 invoked by alias); 21 Oct 2013 12:22:51 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19564 invoked by uid 48); 21 Oct 2013 12:22:47 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58820] lambda multiple inheritance operator() not ambiguous
Date: Mon, 21 Oct 2013 12:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on blocked everconfirmed
Message-ID: <bug-58820-4-IWUD0ZC6e9@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58820-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58820-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01497.txt.bz2
Content-length: 576

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX820

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-21
             Blocks|54367                       |
     Ever confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks Daniel. Could even be a duplicate then.


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

* [Bug c++/58820] lambda multiple inheritance operator() not ambiguous
  2013-10-21  7:36 [Bug c++/58820] New: lambda multiple inheritance operator() not ambiguous sutambe at yahoo dot com
  2013-10-21 12:18 ` [Bug c++/58820] " daniel.kruegler at googlemail dot com
@ 2021-08-27 20:47 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Blocks|54367                       |
             Status|NEW                         |RESOLVED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Unrelated to lambdas really.  Here is a C++98 code which shows the same issue
with clang:
template<class t>
struct i
{
    t operator()(t i);
};
struct overload_set1 : i<int>, i<double>
{
  overload_set1() {}
};
int main(void)
{
  double d1 = 10;
  overload_set1 tt;
  tt(d1);
}


To make the original code work (you need C++17 really):
Adding
  using Fs::operator()...;
allows GCC (and ICC) to work.

So this is a bug in clang.
I don't think we need a testcase as we must likely already have a C++98 one
even.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54367
[Bug 54367] [meta-bug] lambda expressions

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

end of thread, other threads:[~2021-08-27 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21  7:36 [Bug c++/58820] New: lambda multiple inheritance operator() not ambiguous sutambe at yahoo dot com
2013-10-21 12:18 ` [Bug c++/58820] " daniel.kruegler at googlemail dot com
2021-08-27 20:47 ` 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).