[Bug c++/127196] New: [contracts] redeclaration of function with type dependent param used in postcondition accepts non-const param

waffl3x at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 3 06:09:01 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127196

            Bug ID: 127196
           Summary: [contracts] redeclaration of function with type
                    dependent param used in postcondition accepts
                    non-const param
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: waffl3x at gcc dot gnu.org
  Target Milestone: ---

https://godbolt.org/z/nrWf7ExT1
```
template<typename T>
void f(T a)
  post(a);

template<typename T>
void f(T const a) {}

template void f<int>(int);
```
I reckon this will need a bit of a refactor to fix.


More information about the Gcc-bugs mailing list