Open llvmbot opened 10 years ago
Sorry but I don't have that much time on my hands. Either you try and figure out how to reproduce the issue and provide details (what file from VCMI sources and what flags) or attach preprocessed file. The other option is to wait for someone else to pick this up, but that might take a while.
I don't know perhaps you can debug into Clang and find the source of the problem quicker. Therefore you should build VCMI. If you want I can provide you with information.
I tested the function template in a separate small project where PCH enabled/disabled didn't matter. When using the function template in the real scenario (this project: https://github.com/vcmi/vcmi) and having PCH enabled it crashes. In both scenarios I used CMake and Cotire (plugin for generating PCHs).
I compiled the preprocessed.cpp
file as you said with the original compiler arguments and the additions you provided. This will generate something like a preprocessed header file. I feed the file to Clang and received no compiler errors.
I'm a bit confused now, first you said that this only happens when using precompiled header but later you say that pch doesn't matter?
I'm guessing that with this file being a part of larger project you're using some kind of build system. Try extracting the exact command line that invokes clang and just append -E > preprocessed.cpp
. Feed the new file to clang and see if it crashes. Upload it if it does.
If it doesn't we'll have to try precompiled headers :(
Link to download: https://www.dropbox.com/s/f3fydsgpz8e3rtr/vcmi_CXX_prefix.hxx.gch
Preprocessed file was created with CMake's plugin Cotire.
Yeah, give it a try and upload the whole file somewhere if you fail to reduce it.
The file is very large around 56 MB. Perhaps I find a minimal example where this bug occurs.
Can you provide a preprocessed file?
When I use that function template in a separate C++ project which consists only of that template, main function and the template instantiation I don't get any compile error. It works with boost::max_element
and std::max_element
, PCH enabled/disabled doesn't matter. So, I don't know why this bug occurs.
Could you provide a minimal example that crashes? STL and Boost dependencies make this hard enough, precompiled headers more so :)
Maybe try ripping the relevant declarations from the standard library and boost and put them in a dummy header to generate small pch...
Extended Description
Clang crashes when instantiating a function template which uses decltype as the return type and inside the function a
decltype
typedef
. The error only appears when you compile with PCH (precompiled header).Stackdump:
Clang invocation:
Template function:
If no
ElemType
typedef
is used, Clang doesn't crash.