public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50545] New: [C++0x] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent
@ 2011-09-27 21:53 gintensubaru at gmail dot com
2011-10-13 22:02 ` [Bug c++/50545] " jason at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: gintensubaru at gmail dot com @ 2011-09-27 21:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50545
Bug #: 50545
Summary: [C++0x] SFINAE does not handle an explicit type
conversion (functional notation) with a
braced-init-list well if target type is not dependent
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gintensubaru@gmail.com
// tested on gcc-4.7-20110924 (experimental)
template< class T >
T&& declval();
// #1
template< class T >
auto f( int )
-> decltype( int{ declval<T>() } );
// #2
template< class >
void f( ... );
#define STATIC_ASSERT( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ )
template< class T, class U >
struct is_same {
static constexpr bool value = false;
};
template< class T >
struct is_same<T, T> {
static constexpr bool value = true;
};
STATIC_ASSERT( is_same< decltype( f<int>(0) ), int >::value ); // OK;
f<int>(0) calls #1.
STATIC_ASSERT( is_same< decltype( f<int*>(0) ), void >::value ); // static
assertion fails; f<int*>(0) should call #2, because int{ (int*)0 } is
ill-formed, but calls #1.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/50545] [C++0x] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent
2011-09-27 21:53 [Bug c++/50545] New: [C++0x] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent gintensubaru at gmail dot com
@ 2011-10-13 22:02 ` jason at gcc dot gnu.org
2012-08-31 2:50 ` [Bug c++/50545] [C++0x][DR 1172] " jason at gcc dot gnu.org
2012-08-31 15:07 ` jason at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-13 22:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50545
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |SUSPENDED
Last reconfirmed| |2011-10-13
CC| |jason at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-13 22:02:12 UTC ---
int{ declval<T>() } is an example of an "instantiation-dependent" expression
that is neither type-dependent (its type is int) nor value-dependent (because
it's not a constant-expression), so G++ just resolves its decltype to int.
This isn't what we want, but what exactly we do want is an open issue:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1172
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/50545] [C++0x][DR 1172] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent
2011-09-27 21:53 [Bug c++/50545] New: [C++0x] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent gintensubaru at gmail dot com
2011-10-13 22:02 ` [Bug c++/50545] " jason at gcc dot gnu.org
@ 2012-08-31 2:50 ` jason at gcc dot gnu.org
2012-08-31 15:07 ` jason at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2012-08-31 2:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50545
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-08-31 02:50:33 UTC ---
Author: jason
Date: Fri Aug 31 02:50:28 2012
New Revision: 190830
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190830
Log:
PR c++/50545
PR c++/51222
* pt.c (instantiation_dependent_r): New.
(instantiation_dependent_expression_p): New.
(value_dependent_expression_p): Use it. SCOPE_REF is always dependent.
* semantics.c (finish_decltype_type): Use it.
* cp-tree.h: Declare it.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/decltype40.C
trunk/gcc/testsuite/g++.dg/cpp0x/decltype41.C
trunk/gcc/testsuite/g++.dg/cpp0x/decltype42.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/pt.c
trunk/gcc/cp/semantics.c
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/50545] [C++0x][DR 1172] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent
2011-09-27 21:53 [Bug c++/50545] New: [C++0x] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent gintensubaru at gmail dot com
2011-10-13 22:02 ` [Bug c++/50545] " jason at gcc dot gnu.org
2012-08-31 2:50 ` [Bug c++/50545] [C++0x][DR 1172] " jason at gcc dot gnu.org
@ 2012-08-31 15:07 ` jason at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2012-08-31 15:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50545
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.8.0
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-08-31 15:07:40 UTC ---
It was pointed out to me that 14.4 says, "If an expression e involves a
template parameter, decltype(e) denotes a unique dependent type."
"involves a template parameter" is different from "is type-dependent", so G++
was clearly wrong.
Fixed by implementing instantiation-dependent in the way I think we should
resolve 1172.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-31 15:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-27 21:53 [Bug c++/50545] New: [C++0x] SFINAE does not handle an explicit type conversion (functional notation) with a braced-init-list well if target type is not dependent gintensubaru at gmail dot com
2011-10-13 22:02 ` [Bug c++/50545] " jason at gcc dot gnu.org
2012-08-31 2:50 ` [Bug c++/50545] [C++0x][DR 1172] " jason at gcc dot gnu.org
2012-08-31 15:07 ` jason 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).