Issue 147324
Summary clang: Missing line and file in message error when ‘auto’ is used in a not permitted context (and bad diagnostic)
Labels clang
Assignees
Reporter jonathanpoelen
    With this code:

```cpp
int main()
{ 
  struct A
  { 
    void foo(auto x) {} // auto not permitted
  };
} 
```

And clang-18,19,20 or trunk and `-std=c++20` or `-std=c++23`:

> error: templates cannot be declared inside of a local class

No line number, no filename and refer to `template`.

With `-std=c++17`:

```
test.cpp:5:14: error: 'auto' not allowed in function prototype
    5 |     void foo(auto x) {}
      |              ^~~~
```

With gcc (same message for C++17 or C++20):

```
test.cpp: In function ‘int main()’:
test.cpp:5:14: error: ‘auto’ parameter not permitted in this context
    5 |     void foo(auto x) {}
      |              ^~~~
```

https://gcc.godbolt.org/z/5YGdh6Pnb
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to