Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-20955

QTCreator failed to build on Windows due to error C2338

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 4.7.1
    • Qt Creator 4.7.0
    • Building Qt Creator
    • None
    • Windows server 2016 + VS 2017
    • Windows
    • 3ff33198bcf8b426022fd4d50ad0affdbc7edd2a

    Description

      I tried to build QTCreator (master branch revision db9837f) with an upcoming VS2017 on Winodws. It failed to build due to error C2338: You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member type would non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (only for uses of aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conformant behavior.

      Note: This error is by-design and add /D_ENABLE_EXTENDED_ALIGNED_STORAGE option to fix this issue.

      Reproduce steps:
      git clone [git://code.qt.io/qt-creator/qt-creator.git] D:\QTCreator\src
      Open a VS 2015 x86 command prompt and browse to D:\QTCreator\src
      qmake -r qtcreator.pro
      jom

      Actual result:
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\type_traits(1271): error C2338: You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member type would non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (only for uses of aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conformant behavior.
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\type_traits(1291): note: see reference to class template instantiation 'std::_Aligned<1024,64,double,false>' being compiled
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\type_traits(1298): note: see reference to class template instantiation 'std::_Aligned<1024,64,int,false>' being compiled
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\type_traits(1305): note: see reference to class template instantiation 'std::_Aligned<1024,64,short,false>' being compiled
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\type_traits(1312): note: see reference to class template instantiation 'std::_Aligned<1024,64,char,false>' being compiled
      botan_all.cpp(146): note: see reference to class template instantiation 'std::aligned_storage<1024,64>' being compiled

      Suggestion on my side:
      Add /D_ENABLE_EXTENDED_ALIGNED_STORAGE option to fix.
      cl.exe /D_ENABLE_EXTENDED_ALIGNED_STORAGE /MD /bigobj /EHs /GR /wd4127 /wd4244 /wd4250 /wd4267 /wd4334 /wd4702 /wd4996 /W4 /wd4250 /wd4251 /wd4275 /Ibuild\include /nologo /c botan_all.cpp

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kandeler Christian Kandeler
              karenhuang Karen Huang
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes