[llvm-bugs] [Bug 52073] New: Incorrect ODR error with lambda of unevaluated context of c++20

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 5 02:21:32 PDT 2021


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

            Bug ID: 52073
           Summary: Incorrect ODR error with lambda of unevaluated context
                    of c++20
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nickhuang99 at hotmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

c++20 support lambda of unevaluated context and following is example from
standard[temp.over.link#example-3] to stress that they are not violation of ODR
because each lambda is unique. Two lambda-expressions are never considered
equivalent. The following defines two different functions.

template <int N> void f(const char (*s)[([]{ return N; })()]) { }
template <int N> void f(const char (*s)[([]{ return N; })()]) { }


The test (https://www.godbolt.org/z/37Ya1h44c) shows clang-13 not supporting by
giving error of violation of ODR.


<source>:3:23: error: redefinition of 'f'
template <int N> void f(const char (*s)[([]{ return N; })()]) { }
                      ^
<source>:2:23: note: previous definition is here
template <int N> void f(const char (*s)[([]{ return N; })()]) { }
                      ^
1 error generated.
Compiler returned: 1

-- 
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/20211005/81fce020/attachment.html>


More information about the llvm-bugs mailing list