The following code compiles & runs fine on GCC 4.4.2,  it compiles & segfaults
on GCC 4.5.0,  arguments: -std=c++0x -g -fno-inline
#include <iostream>
#include <math.h>
#include <type_traits>

class empty_t {};
static_assert(std::is_empty<empty_t>::value, "sanity check");

int main(int argc, char** argv)
{
    empty_t* x = NULL;
    empty_t y = *x;
    return 0;
}

Core stack trace:
Program terminated with signal 11, Segmentation fault.
#0  0x000000000040060b in main (argc=1, argv=0x7fff9ae7e848) at test.cpp:11
11              empty_t y = *x;


-- 
           Summary: regression on copy-constructor of empty class
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: navin dot kumar at gmail dot com


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

Reply via email to