cynecx added a comment.

Hi :),

First of all, I would like to say that I am new into all the clang stuff 
(software architecture/internal concepts) but I wanted to start hacking clang 
so I went here to check out some ##trivial## clang bugs to fix so I can learn 
internal stuff about clang, with internal stuff I mean how AST/Sema are 
implemented and kinda these things.

So basically, I tried all the day long to find a better approach as @rjmccall 
explained that the key issue is that you can't copy-construct a ##W## from a 
##volatile W&##. The issue might be in ##SemaInit.cpp## -> 
##ResolveConstructorOverload## because when the ##NamedDecl*## loop reaches the 
##const S&## constructor it doesn't know that it's actually copy-constructed so 
it's not setting ##SuppressUserConversions## to ##true##. This has the effect 
that ##AddTemplateOverloadCandidate## also includes user-conversion functions, 
so in this case: ##S(volatile W)## and this is actually what causes the 
infinity loop: ##PerformCopyInitialization -> InitializationSequence::Perform 
->CompleteConstructorCall -> GatherArgumentsForCall -> ...##.
While debugging I basically changed the ##SuppressUserConversions## variable to 
true for the ##W (const S&)## constructor and this solved the infinity-loop 
problem and produced a gcc similar diagnostic message:

  simplified.cpp:13:7: error: no matching constructor for initialization of 'W'
    S s(*w);
        ^~
  simplified.cpp:3:8: note: candidate constructor (the implicit copy 
constructor) not viable: 1st argument ('volatile W')
        would lose volatile qualifier
  struct W {
         ^
  simplified.cpp:3:8: note: candidate constructor (the implicit move 
constructor) not viable: 1st argument ('volatile W')
        would lose volatile qualifier
  struct W {
         ^
  simplified.cpp:4:3: note: candidate constructor not viable: no known 
conversion from 'volatile W' to 'const S &' for
        1st argument
    W( const S& ) {}
    ^
  simplified.cpp:8:15: note: passing argument to parameter here
    S(volatile W) {}

It would be nice if anyone could check if this is a right approach for fixing 
this issue.
Thank you.


http://reviews.llvm.org/D10881



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to