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

            Bug ID: 51607
           Summary: Broken lambdas with C++ modules
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++2a
          Assignee: unassignedclangb...@nondot.org
          Reporter: artyom.lebe...@gmail.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

Consider the following code:

export module main;// <<< Remove this line to make it work correctly

import <iostream>;

export int
main()
{
    ([](){ std::cout << "callback 1\n"; })();
    ([](){ std::cout << "callback 2\n"; })();
    return 0;
}

It has the following output:
callback 1
callback 1

Expected output (it is correct, when the code compiled without modules):
callback 1
callback 2

I use the following commands for compiling:
CXX="/opt/clang-12/bin/clang++"
CXX_FLAGS="-std=c++20 -stdlib=libc++ -Wall -Werror -g -O0"
CXX_FLAGS="$CXX_FLAGS -fmodules -fimplicit-modules
-fmodules-cache-path=modules-cache"
$CXX -c $CXX_FLAGS test.cpp -o test.o
$CXX $CXX_FLAGS test.o -o test_mod

clang version 13.0.0 (https://github.com/llvm/llvm-project.git
c1baf946e6cf611ae871e34db5cfea0f94f4b5a0)
Target: x86_64-unknown-linux-gnu

Also tested on: clang version 12.0.0 (https://github.com/llvm/llvm-project/
b978a93635b584db380274d7c8963c73989944a1)

Clang downloaded from GitHub release page.

I also created repository with reproduction code:
https://github.com/vagran/asio-awaitable-modules-problem-demo/tree/exp-lambdas

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to