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

            Bug ID: 48886
           Summary: consteval function not allowed in default argument to
                    constexpr constructor
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

Hello,

the following valid code is currently rejected by Clang 11 and trunk
(https://godbolt.org/z/645McM):

consteval int Fun() { return 0; }

struct Test {
  constexpr Test(int loc = Fun()) {}
};

Test t{};

The error is:

<source>:4:28: error: cannot take address of consteval function 'Fun' outside
of an immediate invocation
  constexpr Test(int loc = Fun()) {}
                           ^
<source>:1:15: note: declared here
consteval int Fun() { return 0; }
              ^
1 error generated.
Compiler returned: 1


I had a brief communication with Richard Smith who confirmed that the code
above is valid.


I assume this bug is similar to https://bugs.llvm.org/show_bug.cgi?id=47714


Best,

   Andreas

-- 
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