public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58156] New: c++11 bogus ambigous overload with variadic template
@ 2013-08-14 15:15 ppluzhnikov at google dot com
  2020-07-22 20:50 ` [Bug c++/58156] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2013-08-14 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58156
           Summary: c++11 bogus ambigous overload with variadic template
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref b/10321377

/// --- cut ---
template <class T, class... U>
void Foo(U&...) {}

template <class T, class... U>
void Foo(const U&...) {}

void Bar() {
  const int a = 0;
  Foo<int>(a);
}
/// --- cut ---

The test compiles with Clang, errors with current trunk GCC:
g++ (GCC) 4.9.0 20130814 (experimental)


g++ -c t.cc -std=c++11
t.cc: In function ‘void Bar()’:
t.cc:9:14: error: call of overloaded ‘Foo(const int&)’ is ambiguous
    Foo<int>(a);
              ^
t.cc:9:14: note: candidates are:
t.cc:2:7: note: void Foo(U& ...) [with T = int; U = {const int}]
  void Foo(U&...) {}
       ^
t.cc:5:7: note: void Foo(const U& ...) [with T = int; U = {int}]
  void Foo(const U&...) {}
       ^

Also broken with gcc-4.7.
>From gcc-bugs-return-427829-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 14 15:18:10 2013
Return-Path: <gcc-bugs-return-427829-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8311 invoked by alias); 14 Aug 2013 15:18:10 -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 8274 invoked by uid 48); 14 Aug 2013 15:18:08 -0000
From: "hp at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58145] [Regression]: volatileness of write is discarded, perhaps in "lim1" related to loop optimizations
Date: Wed, 14 Aug 2013 15:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hp at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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:
Message-ID: <bug-58145-4-Ws6HUQjzhc@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58145-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58145-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-08/txt/msg00753.txt.bz2
Content-length: 1052

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

--- Comment #3 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Created attachment 30653 [details]
> gcc49-pr58145.patch
>
> Updated patch.

Thank you very much, Jakub!
The missing opportunity to learn trees :) is offset by far by the value of the
promptness of the patch and the right generic incantations for the test-case!

I'll test and regtest this, though the exact change in volatileness won't be
tested beyond the test-case and the code-base where this was spotted.  Still,
apparently the patch can only add volatileness indicators where none was
before, so should be safe even for other branches than trunk.

It's obvious to you and other tree-ssa-savvy people, but IMHO its notable that
fiddling with the test-case reveals that the bug seems limited to
singleton-bit-field-structures of "natural" sizes; 8, 16, 32, (64 etc. where
applicable).  E.g. changing the bit-field-size to 9 or having two bitfields of
16 bits does not trig the bug.


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

* [Bug c++/58156] bogus ambigous overload with variadic template
  2013-08-14 15:15 [Bug c++/58156] New: c++11 bogus ambigous overload with variadic template ppluzhnikov at google dot com
@ 2020-07-22 20:50 ` mpolacek at gcc dot gnu.org
  2020-09-17 20:14 ` cvs-commit at gcc dot gnu.org
  2020-09-17 20:16 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-22 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
           Keywords|                            |rejects-valid
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This happens to be fixed by r11-1571.  Will add the test.

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

* [Bug c++/58156] bogus ambigous overload with variadic template
  2013-08-14 15:15 [Bug c++/58156] New: c++11 bogus ambigous overload with variadic template ppluzhnikov at google dot com
  2020-07-22 20:50 ` [Bug c++/58156] " mpolacek at gcc dot gnu.org
@ 2020-09-17 20:14 ` cvs-commit at gcc dot gnu.org
  2020-09-17 20:16 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-17 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:4f0aa5b051c0d3e81478bcb495e4e072b2d9827d

commit r11-3268-g4f0aa5b051c0d3e81478bcb495e4e072b2d9827d
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Sep 17 15:31:50 2020 -0400

    c++: Add tests for fixed PRs.

    Bugzilla inspection turned up a bunch of old(er) PRs that have been
    fixed.  Let's include them not to regress in the future.

    gcc/testsuite/ChangeLog:

            PR c++/87530
            PR c++/58156
            PR c++/68828
            PR c++/86002
            PR c++/91525
            PR c++/96223
            PR c++/87032
            PR c++/35098
            * g++.dg/cpp0x/move-return4.C: New test.
            * g++.dg/cpp0x/vt-58156.C: New test.
            * g++.dg/cpp2a/concepts-pr68828.C: New test.
            * g++.dg/cpp2a/concepts-pr86002.C: New test.
            * g++.dg/cpp2a/concepts-pr91525.C: New test.
            * g++.dg/cpp2a/constexpr-indeterminate1.C: New test.
            * g++.dg/cpp2a/desig17.C: New test.
            * g++.dg/ext/attrib62.C: New test.

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

* [Bug c++/58156] bogus ambigous overload with variadic template
  2013-08-14 15:15 [Bug c++/58156] New: c++11 bogus ambigous overload with variadic template ppluzhnikov at google dot com
  2020-07-22 20:50 ` [Bug c++/58156] " mpolacek at gcc dot gnu.org
  2020-09-17 20:14 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 20:16 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-09-17 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-09-17 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-14 15:15 [Bug c++/58156] New: c++11 bogus ambigous overload with variadic template ppluzhnikov at google dot com
2020-07-22 20:50 ` [Bug c++/58156] " mpolacek at gcc dot gnu.org
2020-09-17 20:14 ` cvs-commit at gcc dot gnu.org
2020-09-17 20:16 ` mpolacek 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).