public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59135] New: Incorrect ambiguity in constexpr function overloads
@ 2013-11-14 15:47 vexocide at gmail dot com
  2013-11-20  9:11 ` [Bug c++/59135] " daniel.kruegler at googlemail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vexocide at gmail dot com @ 2013-11-14 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59135
           Summary: Incorrect ambiguity in constexpr function overloads
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vexocide at gmail dot com

Created attachment 31220
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31220&action=edit
minimal example

Using built-in specs.
COLLECT_GCC=g++-mp-4.8
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin13/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13
Configured with:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc48/gcc48/work/gcc-4.8.2/configure
--prefix=/opt/local --build=x86_64-apple-darwin13
--enable-languages=c,c++,objc,obj-c++,lto,fortran,java
--libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.8
--with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local
--with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local
--enable-cloog-backend=isl --disable-cloog-version-check
--enable-stage1-checking --disable-multilib --enable-lto
--enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld
--with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--with-pkgversion='MacPorts gcc48 4.8.2_0'
Thread model: posix
gcc version 4.8.2 (MacPorts gcc48 4.8.2_0)

g++-mp-4.8 test.cpp -o test -std=c++11 -Wall -Wextra -Wno-unused-parameter     
                                                                               
                                                 0 s050414t 16:39
test.cpp: In function 'int main(int, char**)':
test.cpp:22:28: error: call of overloaded 'bar(foo<int>, int, int)' is
ambiguous
     bar<0>(foo<int>(), 1, 2);
                            ^
test.cpp:22:28: note: candidates are:
test.cpp:9:16: note: constexpr bool bar(T&&, Us&& ...) [with long unsigned int
N = 0ul; T = foo<int>; Us = {int, int}]
 constexpr bool bar(T && t, Us &&... us)
                ^
test.cpp:15:16: note: constexpr bool bar(foo<T>&&, Us&& ...) [with long
unsigned int N = 0ul; T = int; Us = {int, int}]
 constexpr bool bar(foo<T> && t, Us &&... us)
                ^

clang++-mp-3.4 test.cpp -o test -std=c++11 -Wall -Wextra -Wno-unused-parameter
compiles the example as expected.


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

* [Bug c++/59135] Incorrect ambiguity in constexpr function overloads
  2013-11-14 15:47 [Bug c++/59135] New: Incorrect ambiguity in constexpr function overloads vexocide at gmail dot com
@ 2013-11-20  9:11 ` daniel.kruegler at googlemail dot com
  2020-07-10 12:53 ` familiebaumanns at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-11-20  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The problem seems to exist in gcc 4.7.3 and within the recent 4.9.0 trunk. The
following variant of the code removes unnecessary library dependencies and
constexpr (which is not needed to reproduce the problem):

//----------------------------------
template <typename T>
struct foo
{
};

template <int N, typename T, typename ...Us>
bool bar(T &&, Us &&...)
{
    return false;
}

template <int N, typename T, typename ...Us>
bool bar(foo<T> &&, Us &&...)
{
    return true;
}

int main()
{
    bar<0>(foo<int>(), 1, 2);
}
//----------------------------------
>From gcc-bugs-return-435194-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 20 09:24:04 2013
Return-Path: <gcc-bugs-return-435194-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7771 invoked by alias); 20 Nov 2013 09:24:04 -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 7718 invoked by uid 48); 20 Nov 2013 09:24:00 -0000
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59208] New: ice in initialize_flags_in_bb
Date: Wed, 20 Nov 2013 09:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
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: dcb314 at hotmail dot com
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-59208-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg01971.txt.bz2
Content-length: 1262

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

            Bug ID: 59208
           Summary: ice in initialize_flags_in_bb
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

Created attachment 31256
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31256&action=edit
gzipped C++ source code

The source code from bug # 45875, when compiled with today's trunk
of 20131120, says

bug1.cc: In function ‘void add_button(Widget, int&, Dimension&, DebuggerType,
EntryType, string)’:
bug1.cc:48073:13: internal compiler error: in initialize_flags_in_bb, at
tree-into-ssa.c:459
 static void add_button(Widget form, int& row, Dimension& max_width,
             ^
0xcd9db9 initialize_flags_in_bb
    ../../src/trunk/gcc/tree-into-ssa.c:459
0xcd9db9 mark_block_for_update
    ../../src/trunk/gcc/tree-into-ssa.c:473
0xce1f50 mark_use_interesting
    ../../src/trunk/gcc/tree-into-ssa.c:2456
0xce1f50 prepare_block_for_update
    ../../src/trunk/gcc/tree-into-ssa.c:2531

This worked a few days ago, at 20131117, so there is recent breakage.
>From gcc-bugs-return-435195-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 20 09:25:45 2013
Return-Path: <gcc-bugs-return-435195-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9400 invoked by alias); 20 Nov 2013 09:25:44 -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 9370 invoked by uid 48); 20 Nov 2013 09:25:41 -0000
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59144] weird behavior when dealing with too complicated templates and class hierarchy
Date: Wed, 20 Nov 2013 09:25: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: daniel.kruegler at googlemail dot com
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: cc
Message-ID: <bug-59144-4-ELsT5wZRlR@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59144-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59144-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg01972.txt.bz2
Content-length: 1461

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to tmmikolajczyk from comment #3)
> Why that's not a bug? No matter if the X::bar method is virtual or not it
> should not have any impact on access to it from the derived classes in this
> case IMHO.

If bar is not virtual, it will never be instantiated in your example code and
for the non-instantiated code no diagnostics is required. Making it virtual
provokes its instantiation irrespective of any other missing odr-usage. See
14.7.1 p11:

"An implementation shall not implicitly instantiate a function template, a
variable template, a member template, a non-virtual member function, a member
class, or a static data member of a class template that does not require
instantiation. It is unspecified whether or not an implementation implicitly
instantiates a virtual member function of a class template if the virtual
member function would not otherwise be instantiated."

In other words: You example code is not useful to demonstrate what you intend
to demonstrate.
>From gcc-bugs-return-435196-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 20 09:35:50 2013
Return-Path: <gcc-bugs-return-435196-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18945 invoked by alias); 20 Nov 2013 09:35:49 -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 18879 invoked by uid 48); 20 Nov 2013 09:35:43 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59208] [4.9 Regression] ice in initialize_flags_in_bb
Date: Wed, 20 Nov 2013 09:35: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: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc target_milestone short_desc everconfirmed
Message-ID: <bug-59208-4-3xUbvpm8mD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59208-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59208-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-11/txt/msg01973.txt.bz2
Content-length: 767

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-20
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
            Summary|ice in                      |[4.9 Regression] ice in
                   |initialize_flags_in_bb      |initialize_flags_in_bb
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I suspect r205019.


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

* [Bug c++/59135] Incorrect ambiguity in constexpr function overloads
  2013-11-14 15:47 [Bug c++/59135] New: Incorrect ambiguity in constexpr function overloads vexocide at gmail dot com
  2013-11-20  9:11 ` [Bug c++/59135] " daniel.kruegler at googlemail dot com
@ 2020-07-10 12:53 ` familiebaumanns at gmail dot com
  2020-07-10 23:06 ` redi at gcc dot gnu.org
  2021-08-28  1:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-07-10 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

Bernd Baumanns <familiebaumanns at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |familiebaumanns at gmail dot com

--- Comment #2 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
It works now in gcc trunk

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

* [Bug c++/59135] Incorrect ambiguity in constexpr function overloads
  2013-11-14 15:47 [Bug c++/59135] New: Incorrect ambiguity in constexpr function overloads vexocide at gmail dot com
  2013-11-20  9:11 ` [Bug c++/59135] " daniel.kruegler at googlemail dot com
  2020-07-10 12:53 ` familiebaumanns at gmail dot com
@ 2020-07-10 23:06 ` redi at gcc dot gnu.org
  2021-08-28  1:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-10 23:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |10.1.1, 11.0
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2020-07-10
     Ever confirmed|0                           |1
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed by r11-1571 which was also backported to the gcc-10 branch.

Jason, was this fixed by the change to tsubst_pack_expansion? Should it be
added to the testsuite before closing it?

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

* [Bug c++/59135] Incorrect ambiguity in constexpr function overloads
  2013-11-14 15:47 [Bug c++/59135] New: Incorrect ambiguity in constexpr function overloads vexocide at gmail dot com
                   ` (2 preceding siblings ...)
  2020-07-10 23:06 ` redi at gcc dot gnu.org
@ 2021-08-28  1:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-28  1:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 58354.

*** This bug has been marked as a duplicate of bug 58354 ***

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

end of thread, other threads:[~2021-08-28  1:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 15:47 [Bug c++/59135] New: Incorrect ambiguity in constexpr function overloads vexocide at gmail dot com
2013-11-20  9:11 ` [Bug c++/59135] " daniel.kruegler at googlemail dot com
2020-07-10 12:53 ` familiebaumanns at gmail dot com
2020-07-10 23:06 ` redi at gcc dot gnu.org
2021-08-28  1:54 ` 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).