[forwarded from http://bugs.debian.org/282463] seen on {alpha,i486,x86_64}-linux, with 3.4.3 and HEAD 20041116, ok with 3.3.5 $ g++-4.0 -Wall -DHAVE_CONFIG_H -c -o grap.o grap.cc g++-4.0: Internal error: Segmentation fault (program cc1plus) Please submit a full bug report. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 7611 [details] preprocessed source
The code is invalid but we should not be seg faulting on it. Reduced code: struct string {}; struct DisplayString : public string { DisplayString() ; DisplayString(char *s); DisplayString(string s); DisplayString(DisplayString& ds) ; }; DisplayString a = "%g";
: Search converges between 2004-06-27-trunk (#473) and 2004-06-28-trunk (#474). : Search converges between 2004-06-28-3.4 (#11) and 2004-06-29-3.4 (#12). With the comeau online C++ compiler I get the following error: "ComeauTest.c", line 8: error: "DisplayString::DisplayString(DisplayString &)", required for copy that was eliminated, is not callable because reference parameter cannot be bound to rvalue DisplayString a = "%g"; ^ which is correct. and the reason why this is not valid code is because the "copy" construtor requires a lvalue and we don't have a lvalue here but a rvalue.
The segfault comes from an infinite recursion which eventually causes a stack overflow. My bets are on: 2004-06-28 Nathan Sidwell <nathan@codesourcery.com> PR c++/16174 * call.c (build_temp): Declare. (check_constructor_callable): New. (reference_binding): Only set CHECK_COPY_CONSTRUCTOR if not for CONSTRUCTOR_CALLABLE. (convert_like_real, initialize_reference): Use check_constructor_callable. * cp-tree.h (LOOKUP_CONSTRUCTOR_CALLABLE): New. (LOOKUP_*): Renumber. and it's an easy win :)
*** This bug has been marked as a duplicate of 17431 ***