Bug 49776 - [C++0x]ICE in build_data_member_initialization, at cp/semantics.c:5499
Summary: [C++0x]ICE in build_data_member_initialization, at cp/semantics.c:5499
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Paolo Carlini
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-07-18 10:52 UTC by sscrisk
Modified: 2011-07-26 20:01 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-07-24 21:26:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sscrisk 2011-07-18 10:52:17 UTC
Codes:

struct s
{
 int i[1];

 template<class... Types>
 constexpr s(Types... args)
  : i{args...}
 {}
};

int main()
{
 s test = nullptr;
}


Compiler messages:

$ g++4.7 -std=c++0x -Wall -Wextra -pedantic a.cpp
a.cpp: In constructor 'constexpr s::s(Types ...) [with Types = {std::nullptr_t}]':
a.cpp:13:11:   required from here
a.cpp:7:14: error: cannot convert 'std::nullptr_t' to 'int' in initialization
a.cpp:8:3: internal compiler error: in build_data_member_initialization, at cp/semantics.c:5499
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Info:

$ g++4.7 -v
Built by Equation Solution <http://www.Equation.com>.
Using built-in specs.
COLLECT_GCC=C:\cygwin\home\RiSK\misc\gcc4.7\bin\g++.exe
COLLECT_LTO_WRAPPER=c:/cygwin/home/risk/misc/gcc4.7/bin/../libexec/gcc/i686-pc-mingw32/4.7.0/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../gcc-4.7-20110716-mingw/configure --host=i686-pc-mingw32 --build=x86_64-unknown-linux-gnu --target
=i686-pc-mingw32 --prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gcc/4.7-20110716 --with-gcc --with-gnu
-as --with-gnu-ld --with-host-libstdcxx='-lstdc++ -lsupc++ -lm' --with-ppl=/home/gfortran/gcc-home/binary/mingw32/nat
ive/x86_32/ppl --with-cloog=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/cloog --with-gmp=/home/gfortran/gcc-
home/binary/mingw32/native/x86_32/gmp --with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpfr --with-mp
c=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpc --with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cros
s/x86_32/gcc/4.7-20110716 --disable-shared --disable-nls --disable-tls --disable-win32-registry --enable-libquadmath-
support --enable-libquadmath --enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32 --enable-lto --
enable-static --enable-shared=lto-plugin --enable-plugins --enable-ld=yes --enable-cloog-backend=ppl
Thread model: win32
gcc version 4.7.0 20110716 (experimental) (GCC)
Comment 1 Andrew Pinski 2011-07-24 21:26:39 UTC
Confirmed.
Comment 2 Paolo Carlini 2011-07-26 09:29:44 UTC
The fix seems easy.
Comment 3 paolo@gcc.gnu.org 2011-07-26 20:00:34 UTC
Author: paolo
Date: Tue Jul 26 20:00:31 2011
New Revision: 176809

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176809
Log:
/cp
2011-07-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/49776
	* typeck.c (cp_build_modify_expr): Check digest_init return value
	for error_mark_node.

/testsuite
2011-07-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/49776
	* g++.dg/cpp0x/constexpr-49776.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-49776.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Paolo Carlini 2011-07-26 20:01:51 UTC
Fixed.