public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65091] New: decltype(~arg) fails for template functions
@ 2015-02-17 15:29 ptomulik at meil dot pw.edu.pl
2015-02-18 10:07 ` [Bug c++/65091] " redi at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: ptomulik at meil dot pw.edu.pl @ 2015-02-17 15:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
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=34790&action=edit
ii file generated by -save-temps
The following program does not compile with g++ (although it compiles with
clang++):
template<typename T>
auto foo(T x) -> decltype(~x)
{ return ~x; }
int bar()
{ return foo(10); }
ptomulik@tea:$ g++ -std=c++11 -g -O0 -Wall -Wextra -Werror -pedantic -c -o
test.o test.cpp
test.cpp: In function ‘int bar()’:
test.cpp:6:16: error: no matching function for call to ‘foo(int)’
{ return foo(10); }
^
test.cpp:6:16: note: candidate is:
test.cpp:2:6: note: template<class T> 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 ‘template<class T> decltype (~ x) foo(T) [with T =
int]’:
test.cpp:6:16: required from here
test.cpp:2:6: error: ‘x’ was not declared in this scope
test.cpp:6:19: error: control reaches end of non-void function
[-Werror=return-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<typename T>
auto foo(T x) -> decltype(!x)
{ return !x; }
template<typename T>
auto foo(T x) -> decltype(-x)
{ return -x; }
template<typename T>
auto foo(T x) -> decltype(+x)
{ return +x; }
template<typename T>
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: <gcc-bugs-return-477573-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
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: <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 31317 invoked by uid 48); 17 Feb 2015 15:34:10 -0000
From: "howarth at bromo dot med.uc.edu" <gcc-bugzilla@gcc.gnu.org>
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: <bug-65084-4-sW0X0TCbPG@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65084-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65084-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-02/txt/msg01906.txt.bz2
Content-length: 446
https://gcc.gnu.org/bugzilla/show_bug.cgi?ide084
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?ide088 is a
duplicate?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
@ 2015-02-18 10:07 ` redi at gcc dot gnu.org
2015-04-09 10:02 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2015-02-18 10:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-18
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
2015-02-18 10:07 ` [Bug c++/65091] " redi at gcc dot gnu.org
@ 2015-04-09 10:02 ` mpolacek at gcc dot gnu.org
2015-06-11 0:08 ` paolo.carlini at oracle dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-09 10:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ldionne.2 at gmail dot com
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 65708 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
2015-02-18 10:07 ` [Bug c++/65091] " redi at gcc dot gnu.org
2015-04-09 10:02 ` mpolacek at gcc dot gnu.org
@ 2015-06-11 0:08 ` paolo.carlini at oracle dot com
2015-07-11 19:52 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-06-11 0:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Blocks| |54366
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54366
[Bug 54366] [meta-bug] decltype issues
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
` (2 preceding siblings ...)
2015-06-11 0:08 ` paolo.carlini at oracle dot com
@ 2015-07-11 19:52 ` paolo.carlini at oracle dot com
2015-07-14 21:01 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-11 19:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Assignee|paolo.carlini at oracle dot com |unassigned at gcc dot gnu.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
` (3 preceding siblings ...)
2015-07-11 19:52 ` paolo.carlini at oracle dot com
@ 2015-07-14 21:01 ` paolo.carlini at oracle dot com
2015-07-20 20:02 ` paolo.carlini at oracle dot com
2020-04-02 17:28 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-14 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine again.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
` (4 preceding siblings ...)
2015-07-14 21:01 ` paolo.carlini at oracle dot com
@ 2015-07-20 20:02 ` paolo.carlini at oracle dot com
2020-04-02 17:28 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-20 20:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Assignee|paolo.carlini at oracle dot com |unassigned at gcc dot gnu.org
Target Milestone|--- |6.0
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/65091] decltype(~arg) fails for template functions
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
` (5 preceding siblings ...)
2015-07-20 20:02 ` paolo.carlini at oracle dot com
@ 2020-04-02 17:28 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-02 17:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65091
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |peter_foelsche at mentor dot com
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 94457 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-04-02 17:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 15:29 [Bug c++/65091] New: decltype(~arg) fails for template functions ptomulik at meil dot pw.edu.pl
2015-02-18 10:07 ` [Bug c++/65091] " redi at gcc dot gnu.org
2015-04-09 10:02 ` mpolacek at gcc dot gnu.org
2015-06-11 0:08 ` paolo.carlini at oracle dot com
2015-07-11 19:52 ` paolo.carlini at oracle dot com
2015-07-14 21:01 ` paolo.carlini at oracle dot com
2015-07-20 20:02 ` paolo.carlini at oracle dot com
2020-04-02 17:28 ` jakub 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).