Modules TS and templates

Hi all,

I've been trying out Clang's support for the modules TS and run into a
snag trying to get templates to work. Here are my test files:

export module bar;

#include <iostream>

export template<int index> void bar() {
  std::cout << index << " from bar!" << std::endl;

export module foo;

import bar;

export template<int index> void foo() {

export module main;

import foo;

int main(int argc, char** argv) {

and the build commands:
clang++ -std=gnu++1z -fmodules-ts -Xclang -fmodules-codegen -stdlib=libc++ --precompile -o bar.pcm -c bar.cppm
clang++ -std=gnu++1z -fmodules-ts -Xclang -fmodules-codegen -stdlib=libc++ --precompile -fmodule-file=bar.pcm -o foo.pcm -c foo.cppm
clang++ -std=gnu++1z -fmodules-ts -Xclang -fmodules-codegen -stdlib=libc++ --precompile -fmodule-file=bar.pcm -fmodule-file=foo.pcm -o main.pcm -c main.cppm
clang++ -std=gnu++1z -fmodules-ts -Xclang -fmodules-codegen -stdlib=libc++ -o test main.pcm foo.pcm bar.pcm

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?

Emily Maier