C++ friend Constructor with Templates

I was wondering if the following clang behavior is expected/standard compliant:

1. non-template friend function (not constructor): compiles in gcc and clang
2. non-template friend constructor: compiles in gcc and clang
3. template friend function (not constructor): compiles in gcc and clang
4. template friend constructor: compiles in gcc , but not clang
(compiled in clang 3.0.0 but not clang 3.1+)

Here is an example (use -DUSE_TEMPLATE to control whether the template
or non-template code is compiled):

https://godbolt.org/g/FT7Mzj

In the clang case for (4), it gives an error as if the friend
declaration was never made.

Looking at a C++ standard:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf

It looks like section 14.3.5 gives an explicit example of a
non-template friend constructor being allowed. In 17.5.4, it didn't
look like there was anything to indicate template friend constructors
are treated different than template friend non-constructor functions,
but maybe I'm missing a subtle point in that section or elsewhere.

Thanks,

Matt

No, it looks like a bug to me. Would you mind filing it?
https://bugs.llvm.org

John.

Opened bug 38578:

https://bugs.llvm.org/show_bug.cgi?id=38578

-Matt

Thanks!

John.