[Bug 264877] clang-14 fails with unreasonable cryptic message on a valid C++ code

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 24 Jun 2022 19:12:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264877

            Bug ID: 264877
           Summary: clang-14 fails with unreasonable cryptic message on a
                    valid C++ code
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: toolchain@FreeBSD.org
          Reporter: yuri@freebsd.org
 Attachment #234920 text/plain
         mime type:

Created attachment 234920
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=234920&action=edit
test.cpp

The attached testcase fails in clang-14, but not in clang-13 and earlier.

Failure message:
> $ clang++14 test.cpp
> ld: error: undefined hidden symbol: std::__1::enable_if<(is_move_constructible<int>::value) && (is_move_assignable<int>::value), void>::type std::__1::swap<int>(int&, int&)
> >>> referenced by test.cpp
> >>>               /tmp/test-e3003a.o:(main)
> clang-14: error: linker command failed with exit code 1 (use -v to see invocation)



'#include <stdexcept>' is not a proper header for std::swap, so a correct
outcome should be one of these two:
* fail to find std::swap -- error: no member named 'swap' in namespace 'std'
* succeed (through proxy header inclusion)

The above error message is incorrect and irrelevant. It indicates a problem in
the toolchain.

This is a regression in clang-14.

The problem was discovered due to a failure in science/helfem on 14-CURRENT.

-- 
You are receiving this mail because:
You are the assignee for the bug.