Issue 99892
Summary [clang] Improve error message for template at block scope
Labels clang
Assignees
Reporter chrchr-github
    ~~~c++
int main() {
    template<typename T>
    struct S{};
}
~~~
clang:
~~~
<source>:2:5: error: expected _expression_
    2 |     template<typename T>
      | ^
~~~
gcc:
~~~
<source>:2:5: error: a template declaration cannot appear at block scope
    2 |     template<typename T>
      | ^~~~~~~~
~~~
msvc:
~~~
<source>(2): error C2951: template declarations are only permitted at global, namespace, or class scope
<source>(2): error C3857: 'S': multiple template parameter lists are not allowed
~~~
https://godbolt.org/z/5cGvn68xv
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to