public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context
@ 2014-11-03 14:45 tavianator at gmail dot com
2014-11-03 15:42 ` [Bug c++/63723] " manu at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: tavianator at gmail dot com @ 2014-11-03 14:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
Bug ID: 63723
Summary: Narrowing conversion allowed in braced init list in
SFINAE context
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tavianator at gmail dot com
Created attachment 33877
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33877&action=edit
Preprocessed source
GCC allows narrowing conversions in braced init lists with only a warning. The
documentation suggests that this extension doesn't apply in SFINAE contexts,
but it appears to be wrong:
$ cat foo.cpp
#include <type_traits>
#include <utility>
template <typename From, typename To>
class is_list_convertible_helper
{
template <typename To2>
static void requires_conversion(To2 t);
template <typename From2, typename To2,
typename = decltype(requires_conversion<To2>({std::declval<From2>()}))>
// ^ Braced initializer
static std::true_type helper(int);
template <typename From2, typename To2>
static std::false_type helper(...);
public:
using type = decltype(helper<From, To>(0));
};
template <typename From, typename To>
class is_list_convertible
: public is_list_convertible_helper<From, To>::type
{ };
static_assert(!is_list_convertible<double, int>::value,
"double -> int is narrowing!");
$ g++ -std=c++11 foo.cpp
foo.cpp: In substitution of ‘template<class From2, class To2, class> static
std::true_type is_list_convertible_helper<From, To>::helper(int) [with From2 =
double; To2 = int; <template-parameter-1-3> = <missing>]’:
foo.cpp:18:31: required from ‘class is_list_convertible_helper<double, int>’
foo.cpp:22:7: required from ‘class is_list_convertible<double, int>’
foo.cpp:26:48: required from here
foo.cpp:10:46: warning: narrowing conversion of ‘std::declval<double>()’ from
‘double’ to ‘int’ inside { } [-Wnarrowing]
typename = decltype(requires_conversion<To2>({std::declval<From2>()}))>
^
foo.cpp:26:1: error: static assertion failed: double -> int is narrowing!
static_assert(!is_list_convertible<double, int>::value,
^
>From gcc-bugs-return-465650-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Nov 03 15:30:54 2014
Return-Path: <gcc-bugs-return-465650-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12877 invoked by alias); 3 Nov 2014 15:30:53 -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 12816 invoked by uid 55); 3 Nov 2014 15:30:49 -0000
From: "dave.anglin at bell dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63691] GCC 4.9.x fails to build GLIBC 2.20 on HPPA
Date: Mon, 03 Nov 2014 15:30:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dave.anglin at bell dot net
X-Bugzilla-Status: REOPENED
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:
Message-ID: <bug-63691-4-RQCNmp4HcF@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63691-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63691-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: 2014-11/txt/msg00122.txt.bz2
Content-length: 444
https://gcc.gnu.org/bugzilla/show_bug.cgi?idc691
--- Comment #12 from dave.anglin at bell dot net ---
On 10/31/2014 5:30 PM, aaro.koskinen at iki dot fi wrote:
> I was able to isolate the problem to GLIBC elf/dl-conflict.c and specifically
> hppa specific elf_machine_rela function called from there.
Could you isolate the "wrong code" in elf/dl-conflict.c? It seems a null
pointer check in this object is being incorrectly removed.
Dave
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
@ 2014-11-03 15:42 ` manu at gcc dot gnu.org
2014-11-03 16:14 ` tavianator at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2014-11-03 15:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
and what is that third template parameter?
‘template<class From2, class To2, class> static std::true_type
is_list_convertible_helper<From, To>::helper(int) [with From2 = double; To2 =
int; <template-parameter-1-3> = <missing>]’
>From gcc-bugs-return-465654-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Nov 03 16:02:42 2014
Return-Path: <gcc-bugs-return-465654-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 379 invoked by alias); 3 Nov 2014 16:02:42 -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 346 invoked by uid 48); 3 Nov 2014 16:02:39 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/63721] [5 Regression] IPA ICF cause atomic-comp-swap-release-acquire.c ICE on arm
Date: Mon, 03 Nov 2014 16:02: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: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: target_milestone
Message-ID: <bug-63721-4-Xzf7yuR8u6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63721-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63721-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: 2014-11/txt/msg00126.txt.bz2
Content-length: 292
https://gcc.gnu.org/bugzilla/show_bug.cgi?idc721
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |5.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
2014-11-03 15:42 ` [Bug c++/63723] " manu at gcc dot gnu.org
@ 2014-11-03 16:14 ` tavianator at gmail dot com
2014-11-03 19:22 ` daniel.kruegler at googlemail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tavianator at gmail dot com @ 2014-11-03 16:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
--- Comment #2 from Tavian Barnes <tavianator at gmail dot com> ---
It's decltype(requires_conversion<To2>({std::declval<From2>()})). Not sure why
it says <missing>.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
2014-11-03 15:42 ` [Bug c++/63723] " manu at gcc dot gnu.org
2014-11-03 16:14 ` tavianator at gmail dot com
@ 2014-11-03 19:22 ` daniel.kruegler at googlemail dot com
2014-11-04 14:57 ` tavianator at gmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-11-03 19:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The problem seems to be fixed in gcc HEAD 5.0.0 20141103 (experimental).
>From gcc-bugs-return-465663-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Nov 03 19:44:37 2014
Return-Path: <gcc-bugs-return-465663-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 398 invoked by alias); 3 Nov 2014 19:44:36 -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 32672 invoked by uid 48); 3 Nov 2014 19:44:32 -0000
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug java/41991] gcj segfaults on i686-apple-darwin9 and x86_64-apple-darwin9
Date: Mon, 03 Nov 2014 19:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: java
X-Bugzilla-Version: 4.4.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: fxcoudert at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
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_status resolution
Message-ID: <bug-41991-4-PcLOEqjjY1@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-41991-4@http.gcc.gnu.org/bugzilla/>
References: <bug-41991-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: 2014-11/txt/msg00135.txt.bz2
Content-length: 513
https://gcc.gnu.org/bugzilla/show_bug.cgi?idA991
Bug 41991 depends on bug 44107, which changed state.
Bug 44107 Summary: gcc emits frame (epilogue) info incompatible with the darwin {8,9}-unwinder,10-compacter
https://gcc.gnu.org/bugzilla/show_bug.cgi?idD107
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WONTFIX
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
` (2 preceding siblings ...)
2014-11-03 19:22 ` daniel.kruegler at googlemail dot com
@ 2014-11-04 14:57 ` tavianator at gmail dot com
2014-12-18 23:58 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tavianator at gmail dot com @ 2014-11-04 14:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
--- Comment #4 from Tavian Barnes <tavianator at gmail dot com> ---
Still happens with 4.9.2 though. Is a backport of the fix possible?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
` (3 preceding siblings ...)
2014-11-04 14:57 ` tavianator at gmail dot com
@ 2014-12-18 23:58 ` paolo.carlini at oracle dot com
2014-12-19 0:02 ` paolo at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-12-18 23:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-18
Ever confirmed|0 |1
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This isn't a regression, thus for the time being I'm going to simply add a
testcase. If you want to argue for a backport, please figure out the commit
which fixed the bug and send a message to gcc-patches.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
` (4 preceding siblings ...)
2014-12-18 23:58 ` paolo.carlini at oracle dot com
@ 2014-12-19 0:02 ` paolo at gcc dot gnu.org
2014-12-19 0:04 ` paolo.carlini at oracle dot com
2014-12-19 6:02 ` tavianator at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-12-19 0:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Dec 19 00:02:05 2014
New Revision: 218880
URL: https://gcc.gnu.org/viewcvs?rev=218880&root=gcc&view=rev
Log:
2014-12-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/63723
* g++.dg/cpp0x/sfinae54.C: New.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/sfinae54.C
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
` (5 preceding siblings ...)
2014-12-19 0:02 ` paolo at gcc dot gnu.org
@ 2014-12-19 0:04 ` paolo.carlini at oracle dot com
2014-12-19 6:02 ` tavianator at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-12-19 0:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |5.0
--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/63723] Narrowing conversion allowed in braced init list in SFINAE context
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
` (6 preceding siblings ...)
2014-12-19 0:04 ` paolo.carlini at oracle dot com
@ 2014-12-19 6:02 ` tavianator at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: tavianator at gmail dot com @ 2014-12-19 6:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63723
--- Comment #8 from Tavian Barnes <tavianator at gmail dot com> ---
Actually it is a regression: according to http://gcc.godbolt.org/, GCC 4.6.4
compiled it correctly with -std=c++0x and
typedef decltype(helper<From, To>(0)) type;
instead of
using type = decltype(helper<From, To>(0));
while still allowing
int x{1.0};
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-12-19 6:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-03 14:45 [Bug c++/63723] New: Narrowing conversion allowed in braced init list in SFINAE context tavianator at gmail dot com
2014-11-03 15:42 ` [Bug c++/63723] " manu at gcc dot gnu.org
2014-11-03 16:14 ` tavianator at gmail dot com
2014-11-03 19:22 ` daniel.kruegler at googlemail dot com
2014-11-04 14:57 ` tavianator at gmail dot com
2014-12-18 23:58 ` paolo.carlini at oracle dot com
2014-12-19 0:02 ` paolo at gcc dot gnu.org
2014-12-19 0:04 ` paolo.carlini at oracle dot com
2014-12-19 6:02 ` tavianator at gmail dot com
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).