diff --git a/Schema.Cpp.Test/ExemplarSemanticTypeTests.cs b/Schema.Cpp.Test/ExemplarSemanticTypeTests.cs index 26a9bf9..d3c676e 100644 --- a/Schema.Cpp.Test/ExemplarSemanticTypeTests.cs +++ b/Schema.Cpp.Test/ExemplarSemanticTypeTests.cs @@ -55,6 +55,7 @@ public sealed class ExemplarSemanticTypeTests #pragma once + #include #include #include diff --git a/Schema.Cpp/CppFileBuilder.cs b/Schema.Cpp/CppFileBuilder.cs index f333f0d..6d74192 100644 --- a/Schema.Cpp/CppFileBuilder.cs +++ b/Schema.Cpp/CppFileBuilder.cs @@ -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 . + // 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(""); declaration.Members.Add(Comparison(name, "<=>", "auto")); declaration.Members.Add(new FieldDeclaration(ValueField, UnderlyingAlias) { Visibility = Visibility.Private });