public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64352] New: [5.0 regression] No SFINAE with deleted function
@ 2014-12-18 17:03 lucdanton at free dot fr
2014-12-18 17:43 ` [Bug c++/64352] " jason at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: lucdanton at free dot fr @ 2014-12-18 17:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64352
Bug ID: 64352
Summary: [5.0 regression] No SFINAE with deleted function
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lucdanton at free dot fr
Created attachment 34300
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34300&action=edit
Minimal testcase
Using:
g++-trunk (GCC) 5.0.0 20141218 (experimental)
Testcase:
template<bool B> struct bool_type
{ static constexpr bool value = B; };
using true_type = bool_type<true>;
using false_type = bool_type<false>;
template<typename T> T&& declval();
template<typename...> struct void_ { using type = void; };
template<typename... I> using void_t = typename void_<I...>::type;
template<typename _Tp, typename = void>
struct _Has_addressof_free: false_type { };
template<typename _Tp>
struct _Has_addressof_free
<_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
: true_type { };
struct foo {};
void operator&(foo) = delete;
int main()
{
static_assert( !_Has_addressof_free<int>::value, "" );
// error: use of deleted function 'void operator&(foo)'
static_assert( _Has_addressof_free<foo>::value, "" );
}
This produces the following:
$ g++-trunk -std=c++11 main.cpp
main.cpp: In function 'int main()':
main.cpp:17:33: error: use of deleted function 'void operator&(foo)'
<_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
^
main.cpp:21:6: note: declared here
void operator&(foo) = delete;
^
main.cpp:27:5: error: static assertion failed:
static_assert( _Has_addressof_free<foo>::value, "" );
^
I'm not entirely sure this is a regression, e.g. libstdc++'s
testsuite/experimental/optional/observers/2.cc is very similar
but passes. I'm working on experimental/optional however and
I ended up tripping over this, and I didn't touch the
_Has_addressof_* stuff. It is copied (almost) verbatim here,
but not the declval/true_type/false_type/[__]void[_t] bits,
in case that's of any help.
Changing the deleted definition with e.g. a dummy definition
('{}') makes the program compiles as expected.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64352] [5.0 regression] No SFINAE with deleted function
2014-12-18 17:03 [Bug c++/64352] New: [5.0 regression] No SFINAE with deleted function lucdanton at free dot fr
@ 2014-12-18 17:43 ` jason at gcc dot gnu.org
2014-12-18 22:23 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2014-12-18 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64352
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-12-18
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64352] [5.0 regression] No SFINAE with deleted function
2014-12-18 17:03 [Bug c++/64352] New: [5.0 regression] No SFINAE with deleted function lucdanton at free dot fr
2014-12-18 17:43 ` [Bug c++/64352] " jason at gcc dot gnu.org
@ 2014-12-18 22:23 ` jason at gcc dot gnu.org
2014-12-19 11:50 ` rguenth at gcc dot gnu.org
2015-01-07 15:19 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2014-12-18 22:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64352
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Dec 18 22:22:42 2014
New Revision: 218877
URL: https://gcc.gnu.org/viewcvs?rev=218877&root=gcc&view=rev
Log:
PR c++/64352
* pt.c (tsubst_copy_and_build): Pass complain to mark_used.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/deleted9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64352] [5.0 regression] No SFINAE with deleted function
2014-12-18 17:03 [Bug c++/64352] New: [5.0 regression] No SFINAE with deleted function lucdanton at free dot fr
2014-12-18 17:43 ` [Bug c++/64352] " jason at gcc dot gnu.org
2014-12-18 22:23 ` jason at gcc dot gnu.org
@ 2014-12-19 11:50 ` rguenth at gcc dot gnu.org
2015-01-07 15:19 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-19 11:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64352
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |5.0
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64352] [5.0 regression] No SFINAE with deleted function
2014-12-18 17:03 [Bug c++/64352] New: [5.0 regression] No SFINAE with deleted function lucdanton at free dot fr
` (2 preceding siblings ...)
2014-12-19 11:50 ` rguenth at gcc dot gnu.org
@ 2015-01-07 15:19 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-07 15:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64352
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Jan 7 15:18:32 2015
New Revision: 219310
URL: https://gcc.gnu.org/viewcvs?rev=219310&root=gcc&view=rev
Log:
PR c++/64352
* pt.c (tsubst_copy_and_build): Pass complain to mark_used.
Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/deleted9.C
Modified:
branches/gcc-4_9-branch/gcc/cp/ChangeLog
branches/gcc-4_9-branch/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-07 15:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-18 17:03 [Bug c++/64352] New: [5.0 regression] No SFINAE with deleted function lucdanton at free dot fr
2014-12-18 17:43 ` [Bug c++/64352] " jason at gcc dot gnu.org
2014-12-18 22:23 ` jason at gcc dot gnu.org
2014-12-19 11:50 ` rguenth at gcc dot gnu.org
2015-01-07 15:19 ` 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).