From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17629 invoked by alias); 17 Feb 2015 15:29:43 -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 14872 invoked by uid 48); 17 Feb 2015 15:29:39 -0000 From: "ptomulik at meil dot pw.edu.pl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/65091] New: decltype(~arg) fails for template functions Date: Tue, 17 Feb 2015 15: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: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ptomulik at meil dot pw.edu.pl 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: 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-02/txt/msg01905.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D65091 Bug ID: 65091 Summary: decltype(~arg) fails for template functions Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ptomulik at meil dot pw.edu.pl Created attachment 34790 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D34790&action=3Dedit ii file generated by -save-temps The following program does not compile with g++ (although it compiles with clang++): template auto foo(T x) -> decltype(~x) { return ~x; } int bar() { return foo(10); } ptomulik@tea:$ g++ -std=3Dc++11 -g -O0 -Wall -Wextra -Werror -pedantic -c -o test.o test.cpp test.cpp: In function =E2=80=98int bar()=E2=80=99: test.cpp:6:16: error: no matching function for call to =E2=80=98foo(int)=E2= =80=99 { return foo(10); } ^ test.cpp:6:16: note: candidate is: test.cpp:2:6: note: template decltype (~ x) foo(T) auto foo(T x) -> decltype(~x) ^ test.cpp:2:6: note: template argument deduction/substitution failed: test.cpp: In substitution of =E2=80=98template decltype (~ x) foo(= T) [with T =3D int]=E2=80=99: test.cpp:6:16: required from here test.cpp:2:6: error: =E2=80=98x=E2=80=99 was not declared in this scope test.cpp:6:19: error: control reaches end of non-void function [-Werror=3Dreturn-type] { return foo(10); } ^ cc1plus: all warnings being treated as errors This is specific to the unary operator "~" and expression involving argument name (not its type). All the following variants compile well for instance: template auto foo(T x) -> decltype(!x) { return !x; } template auto foo(T x) -> decltype(-x) { return -x; } template auto foo(T x) -> decltype(+x) { return +x; } template auto foo(T x) -> decltype(~T()) { return ~x; } My gcc is: ptomulik@tea:$ g++ --version g++-4.9.real (Debian 4.9.2-10) 4.9.2 Copyright (C) 2014 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. My OS is Debian 8.0. >>From gcc-bugs-return-477573-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Feb 17 15:34:14 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 31362 invoked by alias); 17 Feb 2015 15:34:13 -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 31317 invoked by uid 48); 17 Feb 2015 15:34:10 -0000 From: "howarth at bromo dot med.uc.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65084] Lack of type narrowing/widening inhibits good vectorization Date: Tue, 17 Feb 2015 15:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: howarth at bromo dot med.uc.edu 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: cc Message-ID: In-Reply-To: References: 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-02/txt/msg01906.txt.bz2 Content-length: 446 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65084 howarth at bromo dot med.uc.edu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |howarth at bromo dot med.uc.edu --- Comment #3 from howarth at bromo dot med.uc.edu --- I assume that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65088 is a duplicate?