User account creation filtered due to spam.

Bug 49514 - [C++0x] Crashes on valid use of constexpr constructor
Summary: [C++0x] Crashes on valid use of constexpr constructor
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-23 10:52 UTC by Johannes Schaub
Modified: 2011-09-23 22:26 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Schaub 2011-06-23 10:52:08 UTC
GCC crashes on this code:

/// snip
struct Vector4D {
  constexpr Vector4D(double x=0, double y=0, double z=0, double t=0)
    :components{x, y, z, t}, 
    x(components[0]), y(components[1]), z(components[2]), t(components[3]) 
    { }
  
  double components[4];
  double &x, &y, &z, &t;
};

Vector4D a{1, 2, 3};
/// snap

Error:

main1.cpp:11:19:   in constexpr expansion of ‘a.Vector4D::Vector4D(1.0e+0, 2.0e+0, 3.0e+0, 0.0)’
main1.cpp:11:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
Comment 1 Paolo Carlini 2011-09-23 22:26:18 UTC
r179128 works fine. If you see again something similar, please re-open.