public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60105] New: [C++11] g++ segfault on enable_if explicit cast operator
@ 2014-02-07 7:08 Andrey.E.Antipov at gmail dot com
2014-02-07 18:05 ` [Bug c++/60105] [C++11] g++-4.8.2 segfaults " Andrey.E.Antipov at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrey.E.Antipov at gmail dot com @ 2014-02-07 7:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60105
Bug ID: 60105
Summary: [C++11] g++ segfault on enable_if explicit cast
operator
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Andrey.E.Antipov at gmail dot com
g++ segfaults on enable_if explicit cast operator.
The code below crashes on gcc-4.8.2 on a mac with
$ g++-4.8 a.cpp -std=c++11 -o ./a
a.cpp: In function 'int main()':
a.cpp:16:18: internal compiler error: Segmentation fault: 11
std::cout << aaaa << std::endl; // This causes a crash
^
a.cpp:16:18: internal compiler error: Abort trap: 6
g++-4.8: internal compiler error: Abort trap: 6 (program cc1plus)
Abort trap: 6
-------------------
#include <iostream>
#include <type_traits>
template <typename V>
struct subclass {
template <typename V2 = V,
typename = typename
std::enable_if<!std::is_same<V2,int>::value>::type>
explicit operator int(){return 1;};
operator V(){return 2.;}
friend std::ostream& operator<<(std::ostream&out, const subclass p){out <<
3; return out;}
};
int main()
{
subclass<int> aaaa;
subclass<double> bbbb;
std::cout << aaaa << std::endl; // This causes a crash
std::cout << bbbb << std::endl;
std::cout << int(aaaa) << std::endl;
std::cout << int(bbbb) << std::endl;
}
---------------------
Commenting out the std::cout << aaaa << std::endl or removing "explicit"
keyword results in successful compilation and 3
3
2
1
output as expected.
g++-4.8 is
$ g++-4.8 -v
Using built-in specs.
COLLECT_GCC=g++-4.8
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc48/4.8.2/libexec/gcc/x86_64-apple-darwin13.0.0/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13.0.0
Configured with: ../configure --build=x86_64-apple-darwin13.0.0
--prefix=/usr/local/Cellar/gcc48/4.8.2 --enable-languages=c,c++,objc,obj-c++
--program-suffix=-4.8 --with-gmp=/usr/local/opt/gmp4
--with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08
--with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011
--with-system-zlib --enable-version-specific-runtime-libs
--enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release
--enable-lto --disable-werror --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 4.8.2 (GCC)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/60105] [C++11] g++-4.8.2 segfaults on enable_if explicit cast operator
2014-02-07 7:08 [Bug c++/60105] New: [C++11] g++ segfault on enable_if explicit cast operator Andrey.E.Antipov at gmail dot com
@ 2014-02-07 18:05 ` Andrey.E.Antipov at gmail dot com
2014-07-07 14:32 ` paolo.carlini at oracle dot com
2014-12-14 0:55 ` [Bug c++/60105] [C++11] ICE " ville.voutilainen at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: Andrey.E.Antipov at gmail dot com @ 2014-02-07 18:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60105
--- Comment #1 from Andrey Antipov <Andrey.E.Antipov at gmail dot com> ---
Tested - crashes on 4.7.3 and 4.7.2 on linux as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/60105] [C++11] g++-4.8.2 segfaults on enable_if explicit cast operator
2014-02-07 7:08 [Bug c++/60105] New: [C++11] g++ segfault on enable_if explicit cast operator Andrey.E.Antipov at gmail dot com
2014-02-07 18:05 ` [Bug c++/60105] [C++11] g++-4.8.2 segfaults " Andrey.E.Antipov at gmail dot com
@ 2014-07-07 14:32 ` paolo.carlini at oracle dot com
2014-12-14 0:55 ` [Bug c++/60105] [C++11] ICE " ville.voutilainen at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-07 14:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60105
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|Andrey.E.Antipov at gmail dot com |
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Works fine in mainline.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/60105] [C++11] ICE on enable_if explicit cast operator
2014-02-07 7:08 [Bug c++/60105] New: [C++11] g++ segfault on enable_if explicit cast operator Andrey.E.Antipov at gmail dot com
2014-02-07 18:05 ` [Bug c++/60105] [C++11] g++-4.8.2 segfaults " Andrey.E.Antipov at gmail dot com
2014-07-07 14:32 ` paolo.carlini at oracle dot com
@ 2014-12-14 0:55 ` ville.voutilainen at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 0:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60105
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Known to work| |5.0
Ever confirmed|0 |1
Known to fail| |4.8.2, 4.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-14 0:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-07 7:08 [Bug c++/60105] New: [C++11] g++ segfault on enable_if explicit cast operator Andrey.E.Antipov at gmail dot com
2014-02-07 18:05 ` [Bug c++/60105] [C++11] g++-4.8.2 segfaults " Andrey.E.Antipov at gmail dot com
2014-07-07 14:32 ` paolo.carlini at oracle dot com
2014-12-14 0:55 ` [Bug c++/60105] [C++11] ICE " ville.voutilainen 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).