From Bugzilla Helper: User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i686) Description of problem: The compiler gives a segmentation fault on a simple file containing a class and a template with complicated template arguments but only when the <complex> header is included. #include <string> #include <complex> class PDO { public: string name; PDO( string p_n) : name(p_n){} }; PDO Divg( "div"); template< template<int> class G, template< template<int> class> class P> P< G> gradient( P< G> A){ return P<G>( A); } Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Compile the above code with g++ -c 2. The problem disappears by leaving out the <complex> header 3. The problem also disappears by commenting out either the construction of Divg or the template Actual Results: Step 1 gives a segmentation fault during compilation and an error message Steps 2 and 3 give no messages Expected Results: If the code is erroneous, an error message without core dump, but I think the code is correct Additional info: /usr/include/g++-3/std/bastring.h: In method `const charT *basic_string<charT, traits, Allocator>::data () const [with charT = char, traits = string_char_traits<char>, Allocator = __default_alloc_template<true, 0>]': /usr/include/g++-3/std/bastring.cc:165: instantiated from `basic_string<charT, traits, Allocator>::replace (unsigned int, unsigned int, const charT *, unsigne d int) [with charT = char, traits = string_char_traits<char>, Allocator = __defa ult_alloc_template<true, 0>]' /usr/include/g++-3/std/bastring.h:223: instantiated from `basic_string<charT, traits, Allocator>::assign (const charT *, unsigned int) [with charT = char, tra its = string_char_traits<char>, Allocator = __default_alloc_template<true, 0>]' /usr/include/g++-3/std/bastring.h:225: instantiated from `basic_string<charT, traits, Allocator>::assign (const charT *) [with charT = char, traits = string_c har_traits<char>, Allocator = __default_alloc_template<true, 0>]' /usr/include/g++-3/std/bastring.h:183: instantiated from `basic_string<charT, traits, Allocator>::basic_string (const charT *) [with charT = char, traits = st ring_char_traits<char>, Allocator = __default_alloc_template<true, 0>]' buggy.C:10: instantiated from here /usr/include/g++-3/std/bastring.h:157: Internal error: Segmentation fault. Please submit a full bug report. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
g++ 3.2 correctly reports x1.C:3: 'string' is used as a type, but is not defined as a type. x1.C:4: parse error before `p_n' x1.C:4: missing ';' before right brace x1.C: In function `void __static_initialization_and_destruction_0(int, int)': x1.C:7: no matching function for call to `PDO::PDO(const char[4])' x1.C:1: candidates are: PDO::PDO() x1.C:1: PDO::PDO(const PDO&) and does not crash