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

extern関数以外でのonlymeta値の計算 #24

Open
nekketsuuu opened this issue Apr 26, 2017 · 0 comments
Open

extern関数以外でのonlymeta値の計算 #24

nekketsuuu opened this issue Apr 26, 2017 · 0 comments

Comments

@nekketsuuu
Copy link
Contributor

たとえば、以下のコードをコミット8ff550bでコンパイルすると Internal Compiler Error (ICE) が起こります (Wandbox)。

ソースコード

import std.stdio

def typeof!(T)(t: T): type {
    return type;
}

def main() {
    val a = 42;
    if (typeof(a) == int32) {
        println("int32");
    } else {
        println("unknown");
    }
}

エラー出力

= LOAD_MODULE(/home/jail/prog.rill)
= LOAD_MODULE(/home/jail/prog.rill) 0.028000s
= GENERATE_CODE(prog.exe)
Fatal error: exception Failure("[ICE] failed to get a ctfed value")
Raised at file "pervasives.ml", line 32, characters 17-33
Called from file "codegen_llvm.ml", line 1831, characters 17-61
Called from file "codegen_llvm.ml", line 491, characters 26-86
Called from file "codegen_llvm.ml", line 526, characters 18-48
Called from file "codegen_llvm.ml", line 1279, characters 38-63
Called from file "list.ml", line 88, characters 24-34
Called from file "codegen_llvm.ml", line 1282, characters 4-43
Called from file "codegen_llvm.ml", line 1292, characters 4-35
Called from file "codegen_llvm.ml", line 474, characters 16-47
Called from file "codegen_llvm.ml", line 526, characters 18-48
Called from file "codegen_llvm.ml", line 717, characters 43-78
Called from file "codegen_llvm.ml", line 519, characters 26-60
Called from file "codegen_llvm.ml", line 159, characters 14-36
Called from file "codegen_llvm.ml", line 1516, characters 14-39
Called from file "codegen_llvm.ml" (inlined), line 210, characters 9-62
Called from file "codegen_llvm.ml", line 216, characters 12-50
Called from file "codegen_llvm.ml", line 159, characters 14-36
Called from file "codegen_llvm.ml", line 2302, characters 10-41
Called from file "main.ml", line 108, characters 22-55

ぶんちょうさんのこのツイートによると「extern関数以外でのonlymeta値の計算は内部的にtemplate相当に変換する必要があるのですが、それをさぼってダミーをハードコードしているためICEになっている」そうです。

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

No branches or pull requests

1 participant