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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to