Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE : SegFault on CTFE opDispatch Constraints #497

Closed
dcousens opened this issue Oct 9, 2013 · 0 comments · Fixed by #510
Closed

ICE : SegFault on CTFE opDispatch Constraints #497

dcousens opened this issue Oct 9, 2013 · 0 comments · Fixed by #510

Comments

@dcousens
Copy link

dcousens commented Oct 9, 2013

The following code

import std.algorithm : all, canFind;

struct Foo {
    float a, b, c;

    auto opDispatch(string swiz)() if (swiz.all!(x => "abc".canFind(x))) {
        return mixin("Foo(" ~ swiz[0] ~ "," ~ swiz[1] ~ "," ~ swiz[2] ~ ")");
    }
}

auto f(Foo f) {
    return f.cab;
}

Makes the following mess

0  ldc2            0x0000000001300fb2 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  ldc2            0x0000000001300e19
2  libpthread.so.0 0x00007f66485ed870
3  ldc2            0x00000000006c7700 X86_64TargetABI::returnInArg(TypeFunction*) + 16
4  ldc2            0x00000000006bf64a DtoFunctionType(Type*, Type*, Type*, bool) + 4058
5  ldc2            0x00000000006c0bdd DtoDeclareFunction(FuncDeclaration*) + 621
6  ldc2            0x00000000006ca138
7  ldc2            0x00000000006ca1f1
8  ldc2            0x00000000006cb0e5 DtoCreateNestedContext(FuncDeclaration*) + 69
9  ldc2            0x00000000006c2708 DtoDefineFunction(FuncDeclaration*) + 1544
10 ldc2            0x000000000071c109 Ir::emitFunctionBodies() + 41
11 ldc2            0x00000000006d049d Module::genLLVMModule(llvm::LLVMContext&, Ir*) + 685
12 ldc2            0x00000000005cc9d0 main + 6960
13 libc.so.6       0x00007f6647833bc5 __libc_start_main + 245
14 ldc2            0x00000000005ea9f5
Error: Could not execute /usr/bin/ldc2: Segmentation fault (core dumped)
dnadlinger added a commit to ldc-developers/dmd-testsuite that referenced this issue Oct 13, 2013
dnadlinger added a commit to dnadlinger/ldc that referenced this issue Oct 13, 2013
redstar pushed a commit that referenced this issue Sep 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant