GithubHelp home page GithubHelp logo

Comments (8)

Syniurge avatar Syniurge commented on July 30, 2024

Hi Kelly,

I started working on the cppaggregate branch, only showcase.d works for the time being but it should catch up quickly since this simplifies things a great deal (the cost being that we'll get different semantics for D classes and for C++ classes, but no more ambiguities between whether a class is value or reference based on C++ compilation options).

I'll have a look at list.d once I bring back vector, string, bitset, deque and map.

from calypso.

wilsonk avatar wilsonk commented on July 30, 2024

Ok, sounds good Elie.

from calypso.

Syniurge avatar Syniurge commented on July 30, 2024

The bug seems to come from DMD: the deduced type for _Predicate throws away the const qualifier in ยซ bool function(const(int) value) ยป, so the previously matching remove_if instance gets discarded too by TypeFunction::callMatch().

Removing const in single_digit() makes list.d compile and run. I'll track where does const disappear tomorrow.

from calypso.

Syniurge avatar Syniurge commented on July 30, 2024

Okay, it's not DMD but this line in Sema while sending the (correct) template argument to instantiate remove_if<...>:

    ArgType = Context.getCanonicalType(ArgType);

Prior to this call:

 (gdb) call ArgType.dump()
 PointerType 0xc0d86f0 'PointerType FunctionProtoType BuiltinType _Bool (*)(const BuiltinType int)'
 `-FunctionProtoType 0xc0d8680 'FunctionProtoType BuiltinType _Bool (const BuiltinType int)' cdecl
   |-BuiltinType 0xa33e520 'BuiltinType _Bool'
   `-QualType 0xa33e5a1 'const BuiltinType int' const
     `-BuiltinType 0xa33e5a0 'BuiltinType int'

Then:

 (gdb) call ArgType.dump()
 PointerType 0xc0d86c0 'PointerType FunctionProtoType BuiltinType _Bool (*)(BuiltinType int)'
 `-FunctionProtoType 0xc0d8640 'FunctionProtoType BuiltinType _Bool (BuiltinType int)' cdecl
   |-BuiltinType 0xa33e520 'BuiltinType _Bool'
   `-BuiltinType 0xa33e5a0 'BuiltinType int'

Clang bug or expected behavior? If it's a bug it's not causing too much harm in Clang which is probably why it's still here, and if it's expected behavior I can't understand why and accustoming the Calypso side to this strange behavior of getCanonicalType won't be easy. In any case I think we should stick with the workaround for now.

from calypso.

Syniurge avatar Syniurge commented on July 30, 2024

It's still in latest Clang 3.7 and it looks like stripping the parameters from qualifiers in canonical function type is sought after..:

http://clang.llvm.org/doxygen/classclang_1_1ASTContext.html#aebe1c0862e34693bddd4683b51558e35 (ASTContext::getCanonicalParamType)

from calypso.

wilsonk avatar wilsonk commented on July 30, 2024

Looks like just using the workaround is the way to go. I tried compiling the cppaggregate branch to test this and I ran into an error in mtype.c...I suppose you must have this fixed on your end??

diff --git a/dmd2/mtype.c b/dmd2/mtype.c
index 19fcc2b..d87862b 100644
--- a/dmd2/mtype.c
+++ b/dmd2/mtype.c
@@ -9797,7 +9797,7 @@ AggregateDeclaration *getAggregateSym(Type *t)

TypeClass *isClassValue(Type *t)
{

  • if (t->ty != Tclass) return false;
  • if (t->ty != Tclass) return NULL;
    TypeClass* tc = (TypeClass*)t;
    return tc->byRef() ? NULL : tc;
    }

Anyways, it looks like things are back to about the same, for libstdc++ tests, as they were a couple weeks ago. I'll see if I can get around to testing some other libs. I can see a few errors in my qt5demo extended version, so some rewriting will be needed.

Is there anything else left to do on this branch or is it going to merge with master right away?

from calypso.

Syniurge avatar Syniurge commented on July 30, 2024

Good catch, and no it's just that my compiler is a cool dude :)

On to the Qt5 demo, and then it'll be on par with master so ready to merge.

from calypso.

Syniurge avatar Syniurge commented on July 30, 2024

This was definitely fixed with the switch from DMD's to Clang's template argument deduction.

from calypso.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.