From 75f758a703924184fc07b01a138bb6f0028d077c Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Wed, 29 Apr 2020 10:19:55 +0200 Subject: d: Merge bug fix from upstream dmd 06160ccae Adds classKind information to the front-end AST, which in turn allows us to fix code generation of type names for extern(C) and extern(C++) structs and classes. Inspecting such types inside a debugger now just works without the need to 'cast(module_name.cxx_type)'. gcc/d/ChangeLog: * d-codegen.cc (d_decl_context): Don't include module in the name of class and struct types that aren't extern(D). --- gcc/testsuite/gdc.test/compilable/test17419.d | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.test/compilable/test17419.d b/gcc/testsuite/gdc.test/compilable/test17419.d index 219ed4f..d67c5b9 100644 --- a/gcc/testsuite/gdc.test/compilable/test17419.d +++ b/gcc/testsuite/gdc.test/compilable/test17419.d @@ -35,3 +35,21 @@ void bar() void nested() { } static assert(__traits(getLinkage, typeof(&nested)) == "D"); } + +class FooD {} +interface FooDInterface {} +extern (C++) class FooCpp {} +extern (C++) struct FooCppStruct {} +extern (C++) interface FooCppInterface {} + +static assert(__traits(getLinkage, FooD) == "D"); +static assert(__traits(getLinkage, FooDInterface) == "D"); +static assert(__traits(getLinkage, FooCpp) == "C++"); +static assert(__traits(getLinkage, FooCppStruct) == "C++"); +static assert(__traits(getLinkage, FooCppInterface) == "C++"); + +version (D_ObjectiveC) +{ + extern (Objective-C) interface FooObjC {} + static assert(__traits(getLinkage, FooObjC) == "Objective-C"); +} -- cgit v1.1