[Bug c++/126878] New: [contracts] parameter pack of reference type used in a contract assertion is rejected

waffl3x at protonmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126878

            Bug ID: 126878
           Summary: [contracts] parameter pack of reference type used in a
                    contract assertion is rejected
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: waffl3x at protonmail dot com
  Target Milestone: ---

https://godbolt.org/z/8W857531h
```
template<typename... Args>
void f(Args&... args)
  pre((... && args)) {}

template void f<int>(int&);
```
Emits "'const' qualifiers cannot be applied to 'Args&'"

This occurs in all 3 contract assertion types, with pack expansion,
fold expression and pack index. I suspect there are more bugs around
here. I will try to add exhaustive test cases covering most the trivial
cases once I've fixed this one.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.