A paper voted into the C++20 working draft changes the definition of aggregate such that classes with any user-declared ctors are no longer aggregates.
The MSVC team builds ITK regularly to detect regressions, and found this failure under our build configuration with the -std:c++latest switch. We are using the following backwards-compatible patch going forward, which you are free to upstream it if C++20 compatibility is on the library's radar.
Patch: itk_latest_c2440.patch.txt
Failures:
D:llvmsrctoolsclanglibToolingRefactoringASTSelection.cpp(354): error C2440: 'initializing': cannot convert from 'initializer list' to 'anonymous-namespace'::SelectedNodeWithParents'
D:\llvm\src\tools\clang\lib\Tooling\Refactoring\ASTSelection.cpp(355): note: No constructor could take the source type, or constructor overload resolution was ambiguous
D:\llvm\src\tools\clang\lib\Tooling\Refactoring\ASTSelection.cpp(362): error C2440: 'initializing': cannot convert from 'initializer list' to 'anonymous-namespace'::SelectedNodeWithParents'
D:llvmsrctoolsclanglibToolingRefactoringASTSelection.cpp(363): note: No constructor could take the source type, or constructor overload resolution was ambiguous
Very interesting! Thanks, @QuellaZhang
Hans @hjmjohnson it's looks like most of these defaulted member function declarations were introduced with your commit 549a19c956bab2b41489816d8bb8d4bd09161583 (_STYLE: Change aggregate classes to mirror std::array_) Please consider removing them. From:
Maybe also add a note to each of them, saying that these classes follow "the rule of zero", in order to allow aggregate initialization.
I'm sorry, because in general I do like all the C++11 style improvements in ITK.
@N-Dekker No problem. The rule of zero is clearly better in this case.
Software development is always a bit of a random-walk process. As long as we are headed in the right direction and just keep moving. :)
Thanks @N-Dekker @hjmjohnson, ITK works well now on MSVC. Thank you so much. :)
Most helpful comment
@N-Dekker No problem. The rule of zero is clearly better in this case.
Software development is always a bit of a random-walk process. As long as we are headed in the right direction and just keep moving. :)