abi-compliance-checker icon indicating copy to clipboard operation
abi-compliance-checker copied to clipboard

definition of std::initializer_list does not match #include <initializer_list>

Open zhuda opened this issue 8 years ago • 9 comments

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.

zhuda avatar Nov 13 '16 04:11 zhuda

@lvc can you help take a look of this issue?

zhuda avatar Dec 21 '16 04:12 zhuda

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>

lvc avatar Dec 21 '16 15:12 lvc

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 avatar Dec 21 '16 15:12 lvc

@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.

zhuda avatar Dec 22 '16 04:12 zhuda

@lvc I tried GCC 6.2. the issue still exists. need more efforts to investigate.

zhuda avatar Jan 11 '17 09:01 zhuda

@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)

crichaud-work avatar Feb 26 '20 03:02 crichaud-work

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.

lvc avatar Mar 30 '20 06:03 lvc

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.

PierreWang avatar Apr 25 '21 09:04 PierreWang

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.

phreed avatar Aug 17 '23 20:08 phreed