This is an archive of the discontinued LLVM Phabricator instance.

Allow the alias to be of a different type.
ClosedPublic

Authored by angelgarcia on Nov 6 2015, 7:21 AM.

Details

Summary

Consider a declaration an alias even if it doesn't have the same unqualified type than the container element, as long as one can be converted to the other using only implicit casts.

Diff Detail

Event Timeline

angelgarcia updated this revision to Diff 39528.Nov 6 2015, 7:21 AM
angelgarcia retitled this revision from to Allow the alias to be of a different type..
angelgarcia updated this object.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.
klimek edited edge metadata.Nov 6 2015, 7:23 AM

Does this still do it for types with a user-provided implicit constructor?

No. There is a test for that just before the one I added.

klimek added a comment.Nov 6 2015, 7:28 AM

Can you add a test with an overloaded conversion operator?

angelgarcia updated this revision to Diff 39530.Nov 6 2015, 7:43 AM
angelgarcia edited edge metadata.

The test revealed a (already existing) bug. If we called getName() on a CXXConversionDecl, we would get the following assertion:

include/clang/AST/Decl.h:170: llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed.

Solved now.

klimek accepted this revision.Nov 6 2015, 7:49 AM
klimek edited edge metadata.

lg

This revision is now accepted and ready to land.Nov 6 2015, 7:49 AM
angelgarcia closed this revision.Nov 6 2015, 7:49 AM