-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Clang] errors with "conflicting types for" function declarations which only differ by return type constness #78499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-frontend Author: наб (nabijaczleweli)
```
$ cat a.c
int qwe(void);
const int qwe(void);
$ cc -c a.c
a.c:2:11: error: conflicting types for 'qwe'
2 | const int qwe(void);
| ^
a.c:1:5: note: previous declaration is here
1 | int qwe(void);
| ^
1 error generated.
$ gcc -Wall -pedantic -c a.c
$ cc --version
Debian clang version 18.0.0 (++20231231112334+c7c912cff945-1~exp1~20231231112352.433)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /bin
$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
(and the same with gcc 13.2.0-7)
In a Draft, 6.7.6.3 Function declarators, Semantics, 4, I see This appears to imply that the types for both declarations are processed thusly (pardon the C++-like syntax): remove_atomic<remove_cv<int>> qwe(void);
remove_atomic<remove_cv<const int>> qwe(void); yielding int qwe(void);
int qwe(void); which is identical. ([Original report](https://101010.pl/@[email protected]/111770387762063846)) |
CC @AaronBallman this feel vaguely familiar but I can't find a similar issue. |
@llvm/issue-subscribers-c Author: наб (nabijaczleweli)
```
$ cat a.c
int qwe(void);
const int qwe(void);
$ cc -c a.c
a.c:2:11: error: conflicting types for 'qwe'
2 | const int qwe(void);
| ^
a.c:1:5: note: previous declaration is here
1 | int qwe(void);
| ^
1 error generated.
$ gcc -Wall -pedantic -c a.c
$ cc --version
Debian clang version 18.0.0 (++20231231112334+c7c912cff945-1~exp1~20231231112352.433)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /bin
$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
(and the same with gcc 13.2.0-7)
In a Draft, 6.7.6.3 Function declarators, Semantics, 4, I see This appears to imply that the types for both declarations are processed thusly (pardon the C++-like syntax): remove_atomic<remove_cv<int>> qwe(void);
remove_atomic<remove_cv<const int>> qwe(void); yielding int qwe(void);
int qwe(void); which is identical. ([Original report](https://101010.pl/@[email protected]/111770387762063846)) |
Duplicate of #39494 |
(and the same with gcc 13.2.0-7)
In a Draft, 6.7.6.3 Function declarators, Semantics, 4, I see
This appears to imply that the types for both declarations are processed thusly (pardon the C++-like syntax):
yielding
which is identical.
(Original report)
The text was updated successfully, but these errors were encountered: