From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27168 invoked by alias); 10 May 2015 03:29:12 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 27119 invoked by uid 48); 10 May 2015 03:28:58 -0000 From: "tom at honermann dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/66091] New: [c++-concepts] Overloading of member operators based on constraints rejected; regression from r211591 Date: Sun, 10 May 2015 03:29: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: tom at honermann dot net 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 Message-ID: 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: 2015-05/txt/msg00773.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D66091 Bug ID: 66091 Summary: [c++-concepts] Overloading of member operators based on constraints rejected; regression from r211591 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: --- The following test case was accepted by r211591 of the c++-concepts branch,= but is rejected by r222769. My interpretation of N4377 is that this test case should be accepted. $ cat t.cpp template concept bool C1() { return requires() { typename T::type1; }; } template concept bool C2() { return C1() && requires() { typename T::type2; }; } template struct S { S& operator++() { return *this; } S& operator++() requires C2() { return *this; } }; # Compiling with r222769: $ g++ -c -std=3Dc++1z t.cpp=20 t.cpp:14:8: error: =E2=80=98S& S::operator++()=E2=80=99 cannot be ove= rloaded S& operator++() ^ t.cpp:12:8: error: with =E2=80=98S& S::operator++()=E2=80=99 S& operator++() ^ >>From gcc-bugs-return-485934-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 10 05:29:50 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 103586 invoked by alias); 10 May 2015 05:29:48 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 103547 invoked by uid 48); 10 May 2015 05:29:42 -0000 From: "yingpo.liao at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/66092] New: Concept can't check variadic template arguments Date: Sun, 10 May 2015 05:29: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: yingpo.liao 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 Message-ID: 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-05/txt/msg00774.txt.bz2 Content-length: 2586 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092 Bug ID: 66092 Summary: Concept can't check variadic template arguments Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: yingpo.liao at gmail dot com Target Milestone: --- Concept can't check variadic template arguments (r222891). The example code shows an implementation of a concept to check if all types are the same via variadic template arguments. It will be okay if we directly print out the results, but will fail (internal compiler error) if we apply the concept to real cases, i.e., a foo() function. $ svn info Path: . Working Copy Root Path: /Users/liao/Downloads/gcc-branch-c++-concepts/c++-concepts URL: svn://gcc.gnu.org/svn/gcc/branches/c++-concepts Relative URL: ^/branches/c++-concepts Repository Root: svn://gcc.gnu.org/svn/gcc Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4 Revision: 222891 Node Kind: directory Schedule: normal Last Changed Author: asutton Last Changed Rev: 222891 Last Changed Date: 2015-05-07 15:25:15 -0500 (Thu, 07 May 2015) $ cat test.cpp #include #include template requires (sizeof...(Args) == 0) constexpr decltype(auto) check() { return std::integral_constant(); } template requires (sizeof...(Args) > 0) constexpr decltype(auto) check() { return std::integral_constant())::value>(); } template concept bool Same() { return decltype(check())::value; } template requires Same() void foo( Args... args ) {} int main() { // OK: print "true" std::cout << std::boolalpha << Same() << std::endl; // ERROR foo(1, 2, 3); return 0; } $ g++ -std=c++1z test.cpp -o test test.cpp:22:41: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:12556 return decltype(check())::value; ^ test.cpp:22:41: internal compiler error: Abort trap: 6 g++: internal compiler error: Abort trap: 6 (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See for instructions.