public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64395] New: void_t doesn't work as expected
@ 2014-12-23 20:10 benzejaa at gmail dot com
2014-12-23 23:33 ` [Bug c++/64395] " redi at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: benzejaa at gmail dot com @ 2014-12-23 20:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64395
Bug ID: 64395
Summary: void_t doesn't work as expected
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: benzejaa at gmail dot com
Hey all!
I have what I *think* is a bug in gcc-4.9.2. I haven't tested it against the
development version (mostly due to a lack of free time).
I was messing around with "void_t concepts", and GCC didn't give me the
expected behavior. I compared to clang, which did give me what I expected, so
my assumption is that of a bug in GCC.
This may be a duplicate under a different name (I find it hard to believe I was
the first person to find the bug), but I couldn't find one.
Here's my test code:
#include<iostream>
#include<utility>
#include<type_traits>
template< class... > using void_t = void;
template< class, class = void >
struct hasSize : std::false_type {};
template< class T >
struct hasSize< T, void_t< decltype( std::declval<const T&>().size()) > > :
std::true_type {};
int main()
{
std::cout << hasSize< std::string >::value << std::endl;
std::cout << hasSize< char >::value << std::endl;
return 0;
}
compiled as "g++ -std=c++11 main.cpp", I get the output:
1
1
and compiled as "clang++ -std=c++11 main.cpp", I get the output:
1
0
As one would expect the second value to be "false", this to me indicates a bug
in g++.
Cheers!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/64395] void_t doesn't work as expected
2014-12-23 20:10 [Bug c++/64395] New: void_t doesn't work as expected benzejaa at gmail dot com
@ 2014-12-23 23:33 ` redi at gcc dot gnu.org
2014-12-24 0:26 ` redi at gcc dot gnu.org
2014-12-24 12:59 ` benzejaa at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-23 23:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64395
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Already fixed on trunk (I don't remember the commit that fixed it)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/64395] void_t doesn't work as expected
2014-12-23 20:10 [Bug c++/64395] New: void_t doesn't work as expected benzejaa at gmail dot com
2014-12-23 23:33 ` [Bug c++/64395] " redi at gcc dot gnu.org
@ 2014-12-24 0:26 ` redi at gcc dot gnu.org
2014-12-24 12:59 ` benzejaa at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-24 0:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64395
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed by r217250
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/64395] void_t doesn't work as expected
2014-12-23 20:10 [Bug c++/64395] New: void_t doesn't work as expected benzejaa at gmail dot com
2014-12-23 23:33 ` [Bug c++/64395] " redi at gcc dot gnu.org
2014-12-24 0:26 ` redi at gcc dot gnu.org
@ 2014-12-24 12:59 ` benzejaa at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: benzejaa at gmail dot com @ 2014-12-24 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64395
benzejaa at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from benzejaa at gmail dot com ---
Good to know, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-24 12:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 20:10 [Bug c++/64395] New: void_t doesn't work as expected benzejaa at gmail dot com
2014-12-23 23:33 ` [Bug c++/64395] " redi at gcc dot gnu.org
2014-12-24 0:26 ` redi at gcc dot gnu.org
2014-12-24 12:59 ` benzejaa 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).