<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang source code incompatibility with C++20"
   href="https://bugs.llvm.org/show_bug.cgi?id=40096">40096</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang source code incompatibility with C++20
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>1998zhangyi@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21253" name="attach_21253" title="p1008r1.pdf">attachment 21253</a> <a href="attachment.cgi?id=21253&action=edit" title="p1008r1.pdf">[details]</a></span>
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 <a href="https://github.com/llvm-mirror/llvm">https://github.com/llvm-mirror/llvm</a>
D:\llvm\src\     
2 git clone -c core.autocrlf=false <a href="https://github.com/llvm-mirror/clang">https://github.com/llvm-mirror/clang</a>
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;</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>