lock3 / meta

123 stars 11 forks source link

injection + modules = internal compiler error #306

Open DaemonSnake opened 3 years ago

DaemonSnake commented 3 years ago

Hi! the following causes clang to crash:

mods/test.mpp:

export module test;

export namespace test {
    template<class T>
    struct type {
      consteval -> namespace(test) fragment namespace {};
    };
}

main.cpp:

import test;

int main() {
  auto x = test::type<int>{};
}

how to compile:

clang++ -fprebuilt-module-path=./mods/ -freflection -std=c++2a -x c++ -c mods/test.mpp -Xclang -emit-module-interface -o mods/test.pcm
clang++ -fprebuilt-module-path=./mods/ -freflection -std=c++2a -c main.cpp -o main.o

I believe the issue is caused here: https://github.com/lock3/meta/blob/6632fc0a490d0f7ef83021844cd88ef153e38237/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp#L1245