Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Schema.Cpp.Test/ExemplarSemanticTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public sealed class ExemplarSemanticTypeTests

#pragma once

#include <compare>
#include <cstdint>
#include <type_traits>

Expand Down
7 changes: 7 additions & 0 deletions Schema.Cpp/CppFileBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ public SourceFile SemanticType(SchemaSemanticType semanticType)
}

declaration.Members.Add(Comparison(name, "==", "bool"));

// A defaulted <=> answers with one of the ordering types, and those live in <compare>.
// libstdc++ happens to have declared them by the time this header is read and libc++ does
// not, so without this the generated type compiles under GCC and is refused by Clang -
// which is exactly the kind of difference a generator must not leave to whoever includes
// it.
mapper.Require("<compare>");
declaration.Members.Add(Comparison(name, "<=>", "auto"));
declaration.Members.Add(new FieldDeclaration(ValueField, UnderlyingAlias) { Visibility = Visibility.Private });

Expand Down
Loading