All goes well until the final step:
/tmp/main-57ffba.o: In function `void foo<3>()':
main.pcm:(.text._Z3fooILi3EEvv[_Z3fooILi3EEvv]+0x5): undefined reference to `void bar<3>()'
/tmp/main-57ffba.o: In function `void foo<5>()':
main.pcm:(.text._Z3fooILi5EEvv[_Z3fooILi5EEvv]+0x5): undefined reference to `void bar<5>()'
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
Am I missing something? If I add an "import bar;" statement to main.cppm
it compiles and works fine. Shouldn't Clang be able to walk the imports
and instantiate the bar template it needs?
So you've put main() into a module's purview. Since it is not exported,
it will have module linkage which means the symbol will most likely
end up decorated and not what the runtime expects. It works with Clang
because currently it exports everything (according to Richard).
Just me test-driving the newly-acquired C++ modules knowledge ;-).