Bug 57827 - compiler segmentation fault
Summary: compiler segmentation fault
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 57888 (view as bug list)
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2013-07-05 01:38 UTC by liwei
Modified: 2013-07-22 09:52 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description liwei 2013-07-05 01:38:56 UTC
When build the following code with GCC 4.8.1:

struct C
{
    constexpr int fun (int x)
    {
        return x + 1;
    }

    int a = 2;
    int b = fun(a);
};

C c;

int main() {}

GCC told me : 

internal compiler error : segmentation fault.

In my opinion, it should present more meaningful result, such as the non-static function 'fun' cannot be used in inline initialization ...
Comment 1 Paolo Carlini 2013-07-05 09:23:46 UTC
This one simply works in mainline.
Comment 2 Paolo Carlini 2013-07-05 09:27:50 UTC
Current clang also accepts it.
Comment 3 Paolo Carlini 2013-07-10 23:00:25 UTC
I'm adding the testcase and closing the bug as fixed for 4.9.0.
Comment 4 Paolo Carlini 2013-07-22 09:52:37 UTC
*** Bug 57888 has been marked as a duplicate of this bug. ***