atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
229 stars 31 forks source link

Cannot mangle injected class name type. UNREACHABLE executed at C:\src\llvm_package_1200-rc3\llvm-project\clang\lib\AST\MicrosoftMangle.cpp:3139! #281

Open GavinRay97 opened 3 years ago

GavinRay97 commented 3 years ago

Attempting to run d++ on this C++ header: https://gist.githubusercontent.com/GavinRay97/b8bdb882a391e63cb7e2f73b247d4a6e/raw/87ddc1678079b7034b91229660a9ad160af0ed5a/juce_audio_plugin_client_amalgamated.h

With the following D file:

#include "./juce_audio_plugin_client_amalgamated.h"

void main() {
  return;
}
DPP_DEFINES =   --define _WIN32 --define _WIN64 --define MSC_VER=1 --define JUCE_MSVC=1 --define JUCE_WINDOWS=1 \
                --define JUCE_STRING=1_UTF_TYPE=16 --define JUCE_PLUGINHOST_VST3=1 \
                --define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1

DPP_FLAGS = --compiler dmd --preprocess-only --parse-as-cpp --c++-standard-17 --detailed-untranslatables \
            --ignore-macros --no-sys-headers \
            --ignore-ns "std" \
            --ignore-cursor "StringRef"

dpp:
    d++ $(DPP_FLAGS) $(DPP_DEFINES) test.dpp
$ make dpp
MAKE Version 5.41  Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
        d++ --compiler dmd --preprocess-only --parse-as-cpp --c++-standard-17 --detailed-untranslatables   --ignore-macros --no-sys-headers   --ignore-ns "std"   --ignore-cursor "StringRef" --define _WIN32 --define _WIN64 --define MSC_VER=1 --define JUCE_MSVC=1 --define JUCE_WINDOWS=1   --define JUCE_STRING=1_UTF_TYPE=16 --define JUCE_PLUGINHOST_VST3=1 --define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 test.dpp

Cannot mangle injected class name type.

UNREACHABLE executed at C:\src\llvm_package_1200-rc3\llvm-project\clang\lib\AST\MicrosoftMangle.cpp:3139!

** error -1073741795 ** deleting dpp

I wasn't really expecting dpp to be able to translate this, mostly was just curious -- but I couldn't find references to this error anywhere so thought it might be useful in case someone else runs across it in the future.

Thanks =)

atilaneves commented 3 years ago

Oof, Windows. Might take me a while to get to this if I can't repro on Linux.

BTW, --c++-standard-17 should be --c++-standard=c++17.

GavinRay97 commented 3 years ago

If you've not got a Windows machine handy, I'm not sure I would bother (that sounds like a lot of work 😅).

I have LLVM 13 built from source on both Windows + Ubuntu (WSL2) so maybe I can build d++ in debug and get a backtrace and post it here if that'd be useful at all

atilaneves commented 3 years ago

That'd be very helpful, thanks.

The problem isn't my access to a Windows machine, it's trying to not punch the wall while using it.