[llvm-bugs] [Bug 44786] New: Weirdness resolving builtin <=> when overload is visible to template definition

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 4 18:11:21 PST 2020


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

            Bug ID: 44786
           Summary: Weirdness resolving builtin <=> when overload is
                    visible to template definition
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Casey at Carter.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 23091
  --> https://bugs.llvm.org/attachment.cgi?id=23091&action=edit
Repro

Compiling this TU (sorry so large, I wanted to make it library-free):

  namespace std {
      struct partial_ordering {
          static const partial_ordering less;
          static const partial_ordering equivalent;
          static const partial_ordering greater;
          static const partial_ordering unordered;

          int x;
      };

      inline constexpr partial_ordering partial_ordering::less{};
      inline constexpr partial_ordering partial_ordering::equivalent{};
      inline constexpr partial_ordering partial_ordering::greater{};
      inline constexpr partial_ordering partial_ordering::unordered{};

      struct weak_ordering {
          static const weak_ordering less;
          static const weak_ordering equivalent;
          static const weak_ordering greater;

          int x;
      };

      inline constexpr weak_ordering weak_ordering::less{};
      inline constexpr weak_ordering weak_ordering::equivalent{};
      inline constexpr weak_ordering weak_ordering::greater{};

      struct strong_ordering {
          static const strong_ordering less;
          static const strong_ordering equal;
          static const strong_ordering equivalent;
          static const strong_ordering greater;

          int x;
      };

      inline constexpr strong_ordering strong_ordering::less{};
      inline constexpr strong_ordering strong_ordering::equal{};
      inline constexpr strong_ordering strong_ordering::equivalent{};
      inline constexpr strong_ordering strong_ordering::greater{};
  } // namespace std

  struct S {};

  int operator<=>(S const&, S const&);

  template <class T>
  constexpr bool f() {
      using X = decltype(T{} <=> T{});
      return true;
  }

  static_assert(f<int>());

with "-std=c++2a" ICEs clang 10 (release/10.x at 8f19f984, but apparently not
trunk https://godbolt.org/z/fNK2jP):

  <=> expressions not supported yet
  UNREACHABLE executed at D:\llvm\clang\lib\AST\StmtProfile.cpp:1539!
  Stack dump:
  0.      Program arguments: d:\clang10\bin\clang++ -std=c++2a test.cpp
  1.      test.cpp:49:36: current parser token ';'
  2.      test.cpp:48:20: parsing function body 'f'
  3.      test.cpp:48:20: in compound statement ('{}')
   #0 0x00007ff6bb7a131b (d:\clang10\bin\clang++.exe+0x10e131b)
   #1 0x00007ff84858cb6d (C:\WINDOWS\System32\ucrtbase.dll+0x6cb6d)
   #2 0x00007ff84858db71 (C:\WINDOWS\System32\ucrtbase.dll+0x6db71)
   #3 0x00007ff6bb73ae5e (d:\clang10\bin\clang++.exe+0x107ae5e)
   #4 0x00007ff6bdf269b7 (d:\clang10\bin\clang++.exe+0x38669b7)
   #5 0x00007ff6bdf21888 (d:\clang10\bin\clang++.exe+0x3861888)
   #6 0x00007ff6bdf2a95a (d:\clang10\bin\clang++.exe+0x386a95a)
   #7 0x00007ff6bdf1f224 (d:\clang10\bin\clang++.exe+0x385f224)
   #8 0x00007ff6bdcc532a (d:\clang10\bin\clang++.exe+0x360532a)
   #9 0x00007ff6bdd2475f (d:\clang10\bin\clang++.exe+0x366475f)
  #10 0x00007ff6bd873574 (d:\clang10\bin\clang++.exe+0x31b3574)
  #11 0x00007ff6bd87c48d (d:\clang10\bin\clang++.exe+0x31bc48d)
  #12 0x00007ff6bd87fce7 (d:\clang10\bin\clang++.exe+0x31bfce7)
  #13 0x00007ff6bd87111f (d:\clang10\bin\clang++.exe+0x31b111f)
  #14 0x00007ff6bd8714e3 (d:\clang10\bin\clang++.exe+0x31b14e3)
  #15 0x00007ff6bd1d4660 (d:\clang10\bin\clang++.exe+0x2b14660)
  #16 0x00007ff6bd2494c3 (d:\clang10\bin\clang++.exe+0x2b894c3)
  #17 0x00007ff6bd24895f (d:\clang10\bin\clang++.exe+0x2b8895f)
  #18 0x00007ff6bd247de4 (d:\clang10\bin\clang++.exe+0x2b87de4)
  #19 0x00007ff6bd1c7966 (d:\clang10\bin\clang++.exe+0x2b07966)
  #20 0x00007ff6bd231c44 (d:\clang10\bin\clang++.exe+0x2b71c44)
  #21 0x00007ff6bd2316ad (d:\clang10\bin\clang++.exe+0x2b716ad)
  #22 0x00007ff6bd234ab4 (d:\clang10\bin\clang++.exe+0x2b74ab4)
  #23 0x00007ff6bd23a67e (d:\clang10\bin\clang++.exe+0x2b7a67e)
  #24 0x00007ff6bd1a9009 (d:\clang10\bin\clang++.exe+0x2ae9009)
  #25 0x00007ff6bd1ef03c (d:\clang10\bin\clang++.exe+0x2b2f03c)
  #26 0x00007ff6bd1ee318 (d:\clang10\bin\clang++.exe+0x2b2e318)
  #27 0x00007ff6bd1edc7f (d:\clang10\bin\clang++.exe+0x2b2dc7f)
  #28 0x00007ff6bd1c7739 (d:\clang10\bin\clang++.exe+0x2b07739)
  #29 0x00007ff6bd1a6c79 (d:\clang10\bin\clang++.exe+0x2ae6c79)
  #30 0x00007ff6bd1a2332 (d:\clang10\bin\clang++.exe+0x2ae2332)
  #31 0x00007ff6bd19fa10 (d:\clang10\bin\clang++.exe+0x2adfa10)
  #32 0x00007ff6bc06a036 (d:\clang10\bin\clang++.exe+0x19aa036)
  #33 0x00007ff6be62bc7f (d:\clang10\bin\clang++.exe+0x3f6bc7f)
  #34 0x00007ff6bc069a55 (d:\clang10\bin\clang++.exe+0x19a9a55)
  #35 0x00007ff6bc022f6f (d:\clang10\bin\clang++.exe+0x1962f6f)
  #36 0x00007ff6bc11c7a1 (d:\clang10\bin\clang++.exe+0x1a5c7a1)
  #37 0x00007ff6ba728e2c (d:\clang10\bin\clang++.exe+0x68e2c)
  #38 0x00007ff6ba71de86 (d:\clang10\bin\clang++.exe+0x5de86)
  #39 0x00007ff6bbf6de71 (d:\clang10\bin\clang++.exe+0x18ade71)
  #40 0x00007ff6bbf6da03 (d:\clang10\bin\clang++.exe+0x18ada03)
  #41 0x00007ff6bb190cd9 (d:\clang10\bin\clang++.exe+0xad0cd9)
  #42 0x00007ff6bb7821ac (d:\clang10\bin\clang++.exe+0x10c21ac)
  #43 0x00007ff6bb781fbc (d:\clang10\bin\clang++.exe+0x10c1fbc)
  #44 0x00007ff6bbf6c2ab (d:\clang10\bin\clang++.exe+0x18ac2ab)
  #45 0x00007ff6bbef7c01 (d:\clang10\bin\clang++.exe+0x1837c01)
  #46 0x00007ff6bbef7de8 (d:\clang10\bin\clang++.exe+0x1837de8)
  #47 0x00007ff6bbed928d (d:\clang10\bin\clang++.exe+0x181928d)
  #48 0x00007ff6ba71f071 (d:\clang10\bin\clang++.exe+0x5f071)
  #49 0x00007ff6be35d024 (d:\clang10\bin\clang++.exe+0x3c9d024)
  #50 0x00007ff849947bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
  #51 0x00007ff84a62ced1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ced1)
  clang++: error: clang frontend command failed due to signal (use -v to see
invocation)
  clang version 10.0.0 (https://github.com/llvm/llvm-project.git
8f19f984f296c8ddbb16dc1623e8a4bd6bfed111)
  Target: x86_64-pc-windows-msvc
  Thread model: posix
  InstalledDir: d:\clang10\bin
  clang++: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
  clang++: note: diagnostic msg:
  ********************

  PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
  Preprocessed source(s) and associated run script(s) are located at:
  clang++: note: diagnostic msg:
C:\Users\cacarter\AppData\Local\Temp\test-49f509.cpp
  clang++: note: diagnostic msg:
C:\Users\cacarter\AppData\Local\Temp\test-49f509.sh
  clang++: note: diagnostic msg:

  ********************

"<=> expressions not supported yet" suggests a change on trunk didn't get
ported to release/10.x?

-- 
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/20200205/b1238f24/attachment-0001.html>


More information about the llvm-bugs mailing list