[llvm-bugs] [Bug 40096] New: Clang source code incompatibility with C++20

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 18 22:23:09 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40096

            Bug ID: 40096
           Summary: Clang source code incompatibility with C++20
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 1998zhangyi at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 21253
  --> https://bugs.llvm.org/attachment.cgi?id=21253&action=edit
p1008r1.pdf

A paper(see attachment p1008r1.pdf) 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 Clang regularly to detect regressions, BTW, we always use
the latest version, and found this failure under our build configuration with
the -std:c++latest switch. We are using the following backwards-compatible
patch(see clangllvm_latest_c2127.patch) going forward, which you are free to
upstream it if C+20 compatibility is on the library's radar.

You can reproduce this issue on the next released MSVC.

Repro steps:
1 git clone -c core.autocrlf=false https://github.com/llvm-mirror/llvm
D:\llvm\src\     
2 git clone -c core.autocrlf=false https://github.com/llvm-mirror/clang
D:\llvm\src\tools\clang
3 open a VS 2017 x86 command prompt and browse to D:\llvm
4 set _CL_=/wd4996 /D_HAS_AUTO_PTR_ETC=1 /D_HAS_TR1_NAMESPACE=1 /std:c++latest
5 mkdir build_x86 && pushd build_x86
6 cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=10.0.17134.0 ..\src\
7 msbuild /maxcpucount:4 /p:Platform=Win32 /p:Configuration=RelWithDebInfo
build_x86\ALL_BUILD.vcxproj /t:Rebuild

Failures:
D:\llvm\src\tools\clang\lib\Tooling\Refactoring\ASTSelection.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:\llvm\src\tools\clang\lib\Tooling\Refactoring\ASTSelection.cpp(363): note: No
constructor could take the source type, or constructor overload resolution was
ambiguous

clangllvm_latest_c2440.patch:
diff --git a/lib/Tooling/Refactoring/ASTSelection.cpp
b/lib/Tooling/Refactoring/ASTSelection.cpp
index 7123fc3..b8f996d 100644
--- a/lib/Tooling/Refactoring/ASTSelection.cpp
+++ b/lib/Tooling/Refactoring/ASTSelection.cpp
@@ -250,8 +250,6 @@ static bool hasAnyDirectChildrenWithKind(const
SelectedASTNode &Node,

 namespace {
 struct SelectedNodeWithParents {
-  SelectedNodeWithParents(SelectedNodeWithParents &&) = default;
-  SelectedNodeWithParents &operator=(SelectedNodeWithParents &&) = default;
   SelectedASTNode::ReferenceType Node;
   llvm::SmallVector<SelectedASTNode::ReferenceType, 8> Parents;

diff --git a/tools/clang-refactor/TestSupport.h
b/tools/clang-refactor/TestSupport.h
index 61aa660..779006b 100644
--- a/tools/clang-refactor/TestSupport.h
+++ b/tools/clang-refactor/TestSupport.h
@@ -59,9 +59,6 @@ struct TestSelectionRangesInFile {
   };
   std::vector<RangeGroup> GroupedRanges;

-  TestSelectionRangesInFile(TestSelectionRangesInFile &&) = default;
-  TestSelectionRangesInFile &operator=(TestSelectionRangesInFile &&) =
default;
-
   bool foreachRange(const SourceManager &SM,
                     llvm::function_ref<void(SourceRange)> Callback) const;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181219/bd8c6137/attachment.html>


More information about the llvm-bugs mailing list