This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/56039] New: ICE in iterative_hash_template_arg, at cp/pt.c:1606
- From: "hstong at ca dot ibm.com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Jan 2013 22:31:32 +0000
- Subject: [Bug c++/56039] New: ICE in iterative_hash_template_arg, at cp/pt.c:1606
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56039
Bug #: 56039
Summary: ICE in iterative_hash_template_arg, at cp/pt.c:1606
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hstong@ca.ibm.com
Host: powerpc64-suse-linux
Target: powerpc64-suse-linux
Build: powerpc64-suse-linux
I am working on a code base which implements type traits using SFINAE,
and when I try it with GCC, I get the reported ICE.
The code uses C++11 lambda expressions in a constant expression context for
the SFINAE. As far as I can tell, SFINAE should apply since the lambda occurs
lexically within the immediate context for the substitution.
I have extracted a functional portion of the code base into a standalone file
(see below).
### Self-contained source:$ cat lambdaSupportedTraits.cc
template <bool> struct BoolSink { typedef void type; };
template <typename T, typename U>
struct AddRvalueReferenceImpl { typedef T type; };
template <typename T>
struct AddRvalueReferenceImpl<T, typename BoolSink<false &&
[] {
extern T &&tref;
}>::type> {
typedef T &&type;
};
template <typename T>
struct AddRvalueReference : AddRvalueReferenceImpl<T, void> { };
namespace ImplHelpers {
template <typename T>
typename AddRvalueReference<T>::type create(void) { }
}
template <typename T, typename U, typename ...Args>
struct IsConstructibleImpl { enum { value = 0 }; };
template <typename T, typename ...Args>
struct IsConstructibleImpl<T, typename BoolSink<false &&
[] {
T t( ::ImplHelpers::create<Args>() ...);
}>::type, Args ...> {
enum { value = 1 };
};
template <typename T, typename ...Args>
struct IsConstructible : IsConstructibleImpl<T, void, Args ...> { };
struct DestroyMe {
~DestroyMe() = delete;
};
static_assert(+IsConstructible<int>::value, "error");
static_assert(!IsConstructible<void>::value, "error");
static_assert(+IsConstructible<int [1]>::value, "error");
static_assert(!IsConstructible<DestroyMe>::value, "error");
static_assert(!IsConstructible<int *, char *>::value, "error");
static_assert(+IsConstructible<int &&, int>::value, "error");
static_assert(!IsConstructible<int &&, int &>::value, "error");
static_assert(+IsConstructible<int &&, int &&>::value, "error");
### Compiler output:$ g++-4.7 -std=c++11 lambdaSupportedTraits.cc -c
lambdaSupportedTraits.cc:10:8: internal compiler error: in
iterative_hash_template_arg, at cp/pt.c:1606
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.
### g++ -v output:$ g++-4.7 -v
Using built-in specs.
COLLECT_GCC=/GCC_INSTALL/bin/g++-4.7
COLLECT_LTO_WRAPPER=/GCC_INSTALL/libexec/gcc/powerpc64-suse-linux/4.7.2/lto-wrapper
Target: powerpc64-suse-linux
Configured with: ../GCC_SOURCE/gcc-4.7.2/configure --prefix=/GCC_INSTALL
--enable-languages=c,c++,fortran --enable-checking=release --enable-ssp
--disable-libssp --with-bugurl=http://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.7
--enable-linux-futex --without-system-libunwind --with-cpu=power4
--enable-secureplt --with-long-double-128 --build=powerpc64-suse-linux
--with-mpc=/GCC_INSTALL/mpc1.0.1 --with-mpfr=/GCC_INSTALL/mpfr3.1.1
--with-gmp=/GCC_INSTALL/gmp5.1
--with-zlib-include=/usr/src/linux-3.0.13-0.27/include/linux
--with-zlib-lib=/lib
Thread model: posix
gcc version 4.7.2 (SUSE Linux)