Simon Martin - Re: Fix PR c++/14622: Type mismatch in explicit template instantiation n (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Hi Mark.

Comparisons of types using pointer-equality are almost always wrong; you have to use same_type_p. Oops. Thanks a lot for pointing this out!

Also, the error message should mention the types. For example:

error ("type %qT for explicit instantiation %qD does not match declared type %qT", TREE_TYPE (result), TREE_TYPE (decl), decl); Ok. Just to be sure, the correct "order" is TREE_TYPE (result), decl and then TREE_TYPE (decl), right? Or should I swap the TREE_TYPEs? What do you think about this other possibility: error ("invalid type for explicit instanciation %qD", decl); error (" expected %qT, got %qT", TREE_TYPE (result), TREE_TYPE (decl)); (Could be in a single call to error if you prefer)

(Why did you use %q#D instead of just %qD?) I used it because it would show "B A::a" instead of just "A::a", which I thought made the error message clearer. However, it's of no use now that the types are explicited.

OK with those changes. I'll wait for your feedback on the error message before resubmitting.

Thanks in advance, Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]