Skip to content

FreeBSD: C++ Interop: Undefined __voidify symbol at link #85368

@etcwilde

Description

@etcwilde

Description

Using maps and vectors with C++ interop results in a link failure due to a missing __voidify symbol.
It looks like we're not instantiating a specialization for the template.

Reproduction

// module.modulemap
module StdMap {
  header "std-map.h"
  requires cplusplus
  export *
}
// std-map.h
#ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_MAP_H
#define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_MAP_H

#include <unordered_map>
#include <vector>

using UnorderedMapGroup = std::unordered_map<int, std::vector<int>>;

#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_MAP_H
// break.swift
import StdMap
import CxxStdlib
import Cxx

let m = UnorderedMapGroup(
    grouping: [
        10, 11,
        20, 21, 22, 23,
        30, 31, 32, 33, 34, 35,
    ], by: { $0 / 10 })

Then run swiftc -I . break.swift -cxx-interoperability-mode=swift-6

error: link command failed with exit code 1 (use -v to see invocation)
ld: error: undefined hidden symbol: void* std::__1::__voidify[abi:se190107]<std::__1::__hash_node<std::__1::__hash_value_type<int, std::__1::vector<int, std::__1::allocator<int>>>, void*>>(std::__1::__hash_node<std::__1::__hash_value_type<int, std::__1::vector<int, std::__1::allocator<int>>>, void*>&)
>>> referenced by break-1.o
>>>               /tmp/TemporaryDirectory.UnyfYH/break-1.o:(std::__1::__hash_node<std::__1::__hash_value_type<int, std::__1::vector<int, std::__1::allocator<int>>>, void*>* std::__1::__construct_at[abi:se190107]<std::__1::__hash_node<std::__1::__hash_value_type<int, std::__1::vector<int, std::__1::allocator<int>>>, void*>, std::nullptr_t, unsigned long&, std::__1::__hash_node<std::__1::__hash_value_type<int, std::__1::vector<int, std::__1::allocator<int>>>, void*>*>(std::__1::__hash_node<std::__1::__hash_value_type<int, std::__1::vector<int, std::__1::allocator<int>>>, void*>*, std::nullptr_t&&, unsigned long&))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Expected behavior

It should link.

Environment

Swift version 6.3-dev (LLVM f5781a07e930f93, Swift e0ca132)
Target: x86_64-unknown-freebsd14.3
Build config: +assertions

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions