public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68093] New: [concepts] friend function declarations that differ only by constraints are rejected as redefinitions
@ 2015-10-26  3:05 tom at honermann dot net
  2020-06-17 14:27 ` [Bug c++/68093] " ppalka at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: tom at honermann dot net @ 2015-10-26  3:05 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5014 bytes --]

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

            Bug ID: 68093
           Summary: [concepts] friend function declarations that differ
                    only by constraints are rejected as redefinitions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net
  Target Milestone: ---

I believe the following code is intended to be well-formed according to P0121r0
[1].  gcc trunk (r229299) currently rejects it.

$ cat t.cpp
struct S1 {};
struct S2 { using t1 = int; };
template<typename T>
concept bool Has_t1() {
    return requires () { typename T::t1; };
}
template<typename T>
struct TS {
    friend void f(TS) {}
    friend void f(TS) requires Has_t1<T>() {} // Unexpected error: redefinition
};
TS<S1> ts1;
TS<S2> ts2;
auto x = []{
             f(ts1);
             f(ts2);
         };

$ gcc --version
gcc (GCC) 6.0.0 20151025 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -c -std=c++1z t.cpp 
t.cpp: In instantiation of ‘struct TS<S1>’:
t.cpp:12:8:   required from here
t.cpp:10:17: error: redefinition of ‘void f(TS<S1>)’
     friend void f(TS) requires Has_t1<T>() {} // Unexpected error:
redefinition
                 ^
t.cpp:9:17: note: ‘void f(TS<S1>)’ previously defined here
     friend void f(TS) {}
                 ^
t.cpp: In instantiation of ‘struct TS<S2>’:
t.cpp:13:8:   required from here
t.cpp:10:17: error: redefinition of ‘void f(TS<S2>)’
     friend void f(TS) requires Has_t1<T>() {} // Unexpected error:
redefinition
                 ^
t.cpp:9:17: note: ‘void f(TS<S2>)’ previously defined here
     friend void f(TS) {}
                 ^

[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0121r0.pdf
>From gcc-bugs-return-500534-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Oct 26 03:26:29 2015
Return-Path: <gcc-bugs-return-500534-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 119847 invoked by alias); 26 Oct 2015 03:26:29 -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 114427 invoked by uid 48); 26 Oct 2015 03:26:24 -0000
From: "baqwas at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/68094] New: Compiler segmentation fault
Date: Mon, 26 Oct 2015 03:26: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: baqwas at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 target_milestone attachments.created
Message-ID: <bug-68094-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: 2015-10/txt/msg02089.txt.bz2
Content-length: 1084

https://gcc.gnu.org/bugzilla/show_bug.cgi?idh094

            Bug ID: 68094
           Summary: Compiler segmentation fault
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baqwas at gmail dot com
  Target Milestone: ---

Created attachment 36585
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id6585&actioníit
Pre-processed source with error report

Compiler issues segmentation fault for very nominal lines of code as shown in
the attachment. Compiler invoked through Arduino IDE (2:1.0.5+dfsg2-4) running
under Debian Jessie on Raspberry Pi 2 platform.

Arduino IDE under Windows 10 does not exhibit any error.

Arduino installed using standard apt-get install command after the customary
update/upgrade steps. Was able to run Arduino IDE successfully under Debian
Wheezy on same platform.

My apologies if this is a "newbie" error but I did not find any equivalent bugs
reported previously.


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

* [Bug c++/68093] [concepts] friend function declarations that differ only by constraints are rejected as redefinitions
  2015-10-26  3:05 [Bug c++/68093] New: [concepts] friend function declarations that differ only by constraints are rejected as redefinitions tom at honermann dot net
@ 2020-06-17 14:27 ` ppalka at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-17 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |10.0
         Resolution|---                         |FIXED
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks like this is fully fixed as of GCC 10.

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

end of thread, other threads:[~2020-06-17 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26  3:05 [Bug c++/68093] New: [concepts] friend function declarations that differ only by constraints are rejected as redefinitions tom at honermann dot net
2020-06-17 14:27 ` [Bug c++/68093] " ppalka 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).