[llvm-bugs] [Bug 49848] New: missing auto in `concept auto arg` error diagnostic needs improvement

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 5 17:17:15 PDT 2021


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

            Bug ID: 49848
           Summary: missing auto in `concept auto arg` error diagnostic
                    needs improvement
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldalessandro at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

If you forget the `auto` in a `concept auto arg` declaration specifically for a
member function template clang provides a confusing diagnostic
https://godbolt.org/z/M5859vqjd.

```
template <class T>
concept thing_t = true;

struct Foo {
    void foo(thing_t const&);
};
```

clang produces

```
<source>:5:14: error: expected parameter declarator
    void foo(thing_t const&);
             ^
<source>:5:22: error: expected ')'
    void foo(thing_t const&);
                     ^
<source>:5:13: note: to match this '('
    void foo(thing_t const&);
            ^
2 errors generated.
Compiler returned: 1

```

where gcc produces

```
<source>:5:14: error: expected 'auto' or 'decltype(auto)' after 'thing_t'
    5 |     void foo(thing_t const&);
      |              ^~~~~~~
Compiler returned: 1
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210406/9ccaca0d/attachment-0001.html>


More information about the llvm-bugs mailing list