<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/119608>119608</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Undefined symbols for "typeinfo for __int128" when using Clang and libc++ on macOS
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ArseniyKholod
      </td>
    </tr>
</table>

<pre>
    I have encountered a linker issue when compiling code with Clang and libc++ on macOS on macOS that involves `typeid(__int128)`. The compilation succeeds, but linking fails with the following error: `Undefined symbols for architecture arm64: "typeinfo for __int128" `. The same happens on x86_64.

It appears that `__int128` itself is supported as a type, but the runtime type information (`typeid`) for it is not being resolved by the linker.

Minimal working example (MWE):
test_clang.cpp:
```
#include <iostream>
#include <string>
#include <typeinfo>

int main()
{
 __int128 t = 1234567890;

  std::cout << typeid(__int128).name();

 return 0;
}
```

Compilation command: `/opt/homebrew/opt/llvm/bin/clang++ test_clang.cpp -stdlib=libc++ -std=gnu++17 -frtti -v`

If the `typeid` line is commented out, the code compiles and links without issues.

Is there a workaround to use `typeid` with `__int128`?
Will support for typeinfo on `__int128` be implemented in future versions of Clang/libc++?

The full error message:
```bash-3.2$ /opt/homebrew/opt/llvm/bin/clang++ test_clang.cpp -stdlib=libc++ -std=gnu++17 -frtti -v
Homebrew clang version 19.1.4
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.4/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin23.cfg
System configuration file directory: /opt/homebrew/etc/clang
User configuration file directory: /Users/runner/.config/clang
 "/opt/homebrew/Cellar/llvm/19.1.4/bin/clang-19" -cc1 -triple arm64-apple-macosx14.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test_clang.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=1 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fbuiltin-headers-in-system-modules -fdefine-target-os-macros -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8.4a -target-feature +aes -target-feature +altnzcv -target-feature +ccdp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +predres -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sb -target-feature +sha2 -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs -target-abi darwinpcs -debugger-tuning=lldb -fdebug-compilation-dir=/Users/runner/work/openfhe-julia/openfhe-julia/test -target-linker-version 1115.7.3 -v -fcoverage-compilation-dir=/Users/runner/work/openfhe-julia/openfhe-julia/test -resource-dir /opt/homebrew/Cellar/llvm/19.1.4/lib/clang/19 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -stdlib=libc++ -internal-isystem /opt/homebrew/Cellar/llvm/19.1.4/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/local/include -internal-isystem /opt/homebrew/Cellar/llvm/19.1.4/lib/clang/19/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include -std=gnu++17 -fdeprecated-macro -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/0w/4z5l9vds32nbkz7l22n8j6s80000gn/T/test_clang-047970.o -x c++ test_clang.cpp
clang -cc1 version 19.1.4 based upon LLVM 19.1.4 default target arm64-apple-darwin23.6.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /opt/homebrew/Cellar/llvm/19.1.4/bin/../include/c++/v1
 /opt/homebrew/Cellar/llvm/19.1.4/lib/clang/19/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/usr/bin/ld" -demangle -lto_library /opt/homebrew/Cellar/llvm/19.1.4/lib/libLTO.dylib -no_deduplicate -dynamic -arch arm64 -platform_version macos 14.0.0 14.0.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -mllvm -enable-linkonceodr-outlining -o a.out /var/folders/0w/4z5l9vds32nbkz7l22n8j6s80000gn/T/test_clang-047970.o -lc++ -lSystem /opt/homebrew/Cellar/llvm/19.1.4/lib/clang/19/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture arm64:
  "typeinfo for __int128", referenced from:
      _main in test_clang-047970.o
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEOVtv27jSv4Z5GVCQKcexH_LgxvVusS0W2Ha335tBkSObDUXqIynX6a8_GEqO01Yp9pI9pwhQe0jO_W4Zo9k7xFt2_Ypdb65knw4-3K5DRGcefjl46_VV7fXD7Rs4yCMCOuV7lzCgBgnWuHsMYGLsET4f0IHybWescXtQXiN8NukAd1a6PUinwZpaMfGKiVfgHbRS_fr-8iEdZALjjt4eMQJblOmhQ6OZWO52xqWZWDKxYouygA8HHAnJ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