[llvm-bugs] [Bug 42959] New: Passing non-trivial type through variadic lambda does not trigger -Wnon-pod-varargs

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 11 05:02:36 PDT 2019


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

            Bug ID: 42959
           Summary: Passing non-trivial type through variadic lambda does
                    not trigger -Wnon-pod-varargs
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: idart at hotmail.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

Tested with Clang 8.0.0 and 8.0.1 on Linux x86-64 (Devuan and CentOS) and the
version that ships with Xcode 10.3 on macOS (Mojave).

Compiled with "-stdlib=libc++ -std=c++17 -O2".


#include <functional>
#include <string>

int main() {
    using Callback = std::function<void (const std::string&)>;
    auto foo = [] (Callback fn, const std::string& arg) { fn(arg); };
    foo([] (...) {}, "");
    return 0;
}


This generate an invalid opcode (ud2) without any warnings or errors.

I'm not sure what I would expected to happen here. I would not expect the
silent generation of an invalid opcode though. The closest thing I could think
of was that this should trigger the -Wnon-pod-varargs error.

-- 
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/20190811/33f782b0/attachment.html>


More information about the llvm-bugs mailing list