abi-compliance-checker
abi-compliance-checker copied to clipboard
definition of std::initializer_list does not match #include <initializer_list>
Hi,
when working on windows and check a project, it reported below error and compilation terminated. Any ideas on how to fix this? in this project I have a file which #include
In file included from c:/program files (x86)/microsoft visual studio 14.0/vc/include/xstddef:9:0, from c:/program files (x86)/microsoft visual studio 14.0/vc/include/limits:11, from c:/program files (x86)/microsoft visual studio 14.0/vc/include/xmemory0:8, from c:/program files (x86)/microsoft visual studio 14.0/vc/include/xmemory:6, from c:/program files (x86)/microsoft visual studio 14.0/vc/include/xtree:6, from c:/program files (x86)/microsoft visual studio 14.0/vc/include/set:6, from ....._change_key_util.h:12, from C:\Users\zhuda\AppData\Local\Temp\BUg6m1mPNc/dump1.h:253: c:/program files (x86)/microsoft visual studio 14.0/vc/include/initializer_list:16:8: fatal error: definition of std::initializer_list does not match #include <initializer_list> class initializer_list ^~~~~~~~~~~~~~~~ compilation terminated.
@lvc can you help take a look of this issue?
Hi,
What version of MinGW GCC you are using?
Please try to add the following XML descriptor option:
<gcc_options>
-std=c++11
</gcc_options>
Please try to install MinGW-W64 GCC-6.2.0
from here:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/6.2.0/
Thank you.
@lvc Thanks for looking this issue. I am using GCC 5.4 from the same link you posted and used -std=c++11
option already.
I will try GCC 6.2 with -std=c++14
instead.
@lvc I tried GCC 6.2. the issue still exists. need more efforts to investigate.
@lvc I have the same issue.I tried the option without success -std=c++11. I tried several installation of MinGW64 (5.4,6.2... up to 8.1)
Hi,
Need to add class initializer_list
to C_Structure
in https://github.com/lvc/abi-compliance-checker/blob/master/modules/Internals/TUDump.pm#L25
Can you please fix this locally and re-check?
Thanks.
Hi,
I also met with this compilation error. I tried to add initializer_list to C_Structure, but it doesn't work.
I have tried to edit either like this: "initializer_list", "sigval",
or like this: "class initializer_list", "sigval",
but neither change worked.
initializer_list
is special so there is a test
which produces the error you are seeing.
fatal_error (input_location,
"definition of std::initializer_list does not match "
"#include <initializer_list>");
The following is tested.
- the
initializer_list
must not be a union (i.e. it is a class or a struct) - the
initializer_list
must be a template - the first data-member in
initializer_list
must be a pointer - the second data-member in
initializer_list
must be a size-type (which was specified when the compiler itself was compiled)
Your compiler appears to be picking up the VisualStudio version of initializer_list
which does not meet these criteria.