[llvm-bugs] [Bug 49852] New: Parameter packs and variadic arguments: Clang, gcc, and msvc differ on this one

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 5 21:16:38 PDT 2021


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

            Bug ID: 49852
           Summary: Parameter packs and variadic arguments: Clang, gcc,
                    and msvc differ on this one
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthurd at acm.org
                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

Clang on trunk, 11, and 10 seems to get the "add_three" second example below
wrong. Clang 9 generates an error FWIW.
____________________

gcc, clang, and msvc all compile this fun one:

auto foo(auto......) { return 42; }
int add_three() { return foo<int,int>(3,4,5); }
____________________

But they argue about this curious one:

[[nodiscard]] constexpr auto foo(auto...t...) noexcept {return (... + t);}
int add_three() { return foo<int,int>(3,4,5);} //gcc(7),  clang(12), msvc(err)
int add_more()  { return foo(3,4,5,6);       } //gcc(18), clang(18), msvc(err)

https://godbolt.org/z/cEoYrn4T8
____________________

It feels to me like gcc is doing the right thing. Which two compilers have
bugs?

--Matt.

-- 
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/20210406/fe067639/attachment.html>


More information about the llvm-bugs mailing list