[llvm-bugs] [Bug 51483] New: Error if immediate function is used as default function argument initializer

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 15 04:27:16 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51483

            Bug ID: 51483
           Summary: Error if immediate function is used as default
                    function argument initializer
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fchelnokov at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Compilation of this valid code:
```
consteval int foo() { return 0; }
int bar(int a = foo()) { return a; }
int main() { return bar(); }
```
results in error:
```
error: cannot take address of consteval function 'foo' outside of an immediate
invocation
int bar(int a = foo()) { return a; }
                ^
```
Other compilers accept: https://gcc.godbolt.org/z/z8h7MPaGx

-- 
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/20210815/bbf8d08e/attachment.html>


More information about the llvm-bugs mailing list