Skip to content

Commit

Permalink
Improve type name compatibility #451
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Dec 12, 2019
1 parent 38382f8 commit 62ec4d4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions cppwinrt/file_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@ namespace cppwinrt

// Class names are always required for activation.
// Class, enum, and struct names are required for producing GUIDs for generic types.
// Interface and delegates names are not required by WinRT.
// Interface and delegates names are required for Xaml compatibility.
w.write_each<write_name>(members.classes);
w.write_each<write_name>(members.enums);
w.write_each<write_name>(members.structs);
write_lean_and_mean(w);
w.write_each<write_name>(members.interfaces);
w.write_each<write_name>(members.delegates);
write_endif(w);

w.write_each<write_guid>(members.interfaces);
w.write_each<write_guid>(members.delegates);
Expand Down
5 changes: 1 addition & 4 deletions test/test/generic_type_names.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
//
// Note that WINRT_LEAN_AND_MEAN is not defined for these tests.
//

// Windows.Foundation is intentionally *not* included here to ensure that stable names/guids
// are generated with only the xxx.0.h header. This ensures that indirect declarations produce
// stable identity values.
#define WINRT_LEAN_AND_MEAN
#include "winrt/Windows.Storage.h"

#include "catch.hpp"
Expand Down
2 changes: 1 addition & 1 deletion test/test/generic_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ TEST_CASE("generic_types")

// Clang 9 doesn't think this is a constant expression.
#ifndef __clang__
REQUIRE_EQUAL_NAME(L"{96369f54-8eb6-48f0-abce-c1b211e627c3}", IStringable);
REQUIRE_EQUAL_NAME(L"Windows.Foundation.IStringable", IStringable);
#endif
}

0 comments on commit 62ec4d4

Please sign in to comment.