Diagnose local class with template?

Clang does not diagnose a local class with a template member.
gcc does.

$ cat test.cpp
int test() {
  class A {
    template<typename T> class B {
      T t;
  return 0;
$ clang -c test.cpp
$ gcc -c test.cpp
test.cpp: In function 'int test()':
test.cpp:3:5: error: invalid declaration of member template in local class

[temp.mem]p2 seems clear: "A local class shall not have member templates."

Is this a Clang bug or am I misreading the standard again?



Thanks! PR16947.