[llvm-bugs] [Bug 52183] New: Linking error for immediate functions returning void in Clang
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 14 12:43:46 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52183
Bug ID: 52183
Summary: Linking error for immediate functions returning void
in Clang
Product: clang
Version: 12.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++2b
Assignee: unassignedclangbugs at nondot.org
Reporter: fchelnokov 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
Clang++ produces linker error if one calls an immediate function returning void
not from a context of another immediate function as in the example:
```
consteval void f(int * x) {
if(x) *x = 1;
}
consteval int g() {
int y = 0;
f(&y);
return y;
}
int main() {
(void)g(); //ok everywhere
f(nullptr); //linker error in Clang
}
```
The error is:
```
undefined reference to `f(int*)'
```
Demo: https://gcc.godbolt.org/z/PT8ezfnrW
Related discussion: https://stackoverflow.com/q/69513993/7325599
--
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/20211014/753dd599/attachment.html>
More information about the llvm-bugs
mailing list