[llvm-bugs] [Bug 49598] New: Immediate function in requires-expression not found by ADL

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 15 16:46:56 PDT 2021


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

            Bug ID: 49598
           Summary: Immediate function in requires-expression not found by
                    ADL
           Product: clang
           Version: trunk
          Hardware: PC
               URL: https://godbolt.org/z/8PaYaG
                OS: Linux
            Status: NEW
          Keywords: compile-fail
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: johelegp at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    johelegp at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

See https://godbolt.org/z/8PaYaG.
```C++
struct A{};
template<auto V> consteval bool f() { return false; }
template<auto V> requires requires { g(&V); } consteval bool f() { return true;
}
consteval bool g(const A*);
static_assert(f<A{}>());
```
```
<source>:5:1: error: static_assert failed due to requirement 'f<A{}>()'
static_assert(f<A{}>());
^             ~~~~~~~~
1 error generated.
Compiler returned: 1
```

It works if `g` is `constexpr`.

-- 
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/20210315/9b16f99d/attachment-0001.html>


More information about the llvm-bugs mailing list