sandialabs / seacas

The Sandia Engineering Analysis Code Access System (SEACAS) is a suite of preprocessing, postprocessing, translation, and utility applications supporting finite element analysis software using the Exodus database file format.
Other
131 stars 79 forks source link

[MSVC][c++20][c++latest] Ioss_DatabaseIO.C failed with error 7525: call to immediate function is not a constant expression #475

Closed NEIL-smtg closed 1 month ago

NEIL-smtg commented 1 month ago

I work on MSVC compiler testing, and we regularly build popular open-source project such as VTK. VTK uses this repo as one of the third-party modules.

I have reported this issue at VTK #19415. I believe the problematic line that is https://github.com/sandialabs/seacas/blob/abc1a6b58d77bd62f255bd93b2950d3e017c3848/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C#L1641

We have encountered the following errors when building VTK with MSVC under the c++20 and c++latest mode:

vtk\ThirdParty\ioss\vtkioss\Ioss_DatabaseIO.C(1643,28): error C7595: 'vtkfmt::v10::basic_format_string<char,double &,char &>::basic_format_string': call to immediate function is not a constant expression [C:\gitP\vtk\vtk\build_amd64\ThirdParty\ioss\vtkioss\ioss.vcxproj]

vtk\ThirdParty\ioss\vtkioss\Ioss_Utils.C(1381,20): error C7595: 'vtkfmt::v10::basic_format_string<char>::basic_format_string': call to immediate function is not a constant expression [C:\gitP\vtk\vtk\build_amd64\ThirdParty\ioss\vtkioss\ioss.vcxproj]
C:\gitP\vtk\vtk\ThirdParty\ioss\vtkioss\Ioss_Utils.C(1381,20): failure was caused by a read of a variable outside its lifetime
C:\gitP\vtk\vtk\ThirdParty\ioss\vtkioss\Ioss_Utils.C(1381,20): see usage of 'suffix'

Step to reproduce:

  1. Download the preprocessed file Ioss_DatabaseIO.txt
  2. Run the following command: cl /c /TP /EHsc /std:c++20 Ioss_DatabaseIO.txt
gsjaardema commented 1 month ago

I think these are now fixed; I was not able to reproduce the errors, but I think I understand what is causing them and have comitted a fix in 80470e6

spyridon97 commented 1 month ago

@NEIL-smtg can you verify that these fixes have fixed your issue?

NEIL-smtg commented 1 month ago

@spyridon97 yes, I can confirm that both errors have been fixed.

NEIL-smtg commented 1 month ago

Closing this issue, since the errors have been fixed