[Bug c++/102635] New: Wrong rejection of function default argument value depending on argument name

fchelnokov at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 7 06:47:47 GMT 2021


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

            Bug ID: 102635
           Summary: Wrong rejection of function default argument value
                    depending on argument name
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This function definition is valid:
```
void f(int y = sizeof(y)) {}
```
per https://timsong-cpp.github.io/cppwp/n4861/dcl.fct.default#9

It is accepted in Clang, but wrongly rejected in GCC. Demo:
https://gcc.godbolt.org/z/WGWdxvMd5

See related discussion: https://stackoverflow.com/a/69461683/7325599


More information about the Gcc-bugs mailing list