g++ gives an "internal compiler error: Segmentation fault"
    message where it should give an error about illegal code.  I've included
    code to cause the problem.  This code shows a mistake in the
    initialization of a template member.  The template was used incorrectly.

The simple problem code is:

/* The example code that causes the failure: */
template <int ndim_ = 0>
class bob  {
    const int ndim;
};

/* note that the mistake below causes the g++ crash:
 * bob<ndim> below should be bob<ndim_>
 */
template <int ndim_>
const int bob<ndim>::ndim = ndim_;

int main() {
    bob<> a;
    return 0;
}

-- 
           Summary: g++ crashes with a contrived template mistake.
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: olsonse at umich dot edu
                CC: gcc-bugs at gcc dot gnu dot org,olsonse at umich dot edu
 GCC build triplet: x86_64-suse-linux-gnu
  GCC host triplet: x86_64-suse-linux-gnu
GCC target triplet: x86_64-suse-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20476

Reply via email to