This is the mail archive of the gcc-patches@gcc.gnu.org mailing 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]

Re: [c++-concepts] code review


On 06/18/2013 12:27 PM, Andrew Sutton wrote:
There was a bug in instantiation_dependent_expr_r that would cause
trait expressions like __is_class(int) to be marked as type dependent.
It was always testing the 2nd operand, even for unary traits
(NULL_TREE turns out to be type dependent).

I fixed that last month:

2013-05-20  Jason Merrill  <jason@redhat.com>

        PR c++/57016
        * pt.c (instantiation_dependent_r) [TRAIT_EXPR]: Only check
        type2 if there is one.

If you want to keep the is_binary_trait stuff, that's fine, except that

+extern bool is_binary_trait                     (cp_trait_kind);
...
+inline bool
+is_binary_trait (cp_trait_kind k)

violates the rules for inline functions: an inline function must be declared as inline before any uses and defined in all translation units that use it.

+// reduced terms in the constraints language. Note that conjoining with a
+// non-null expression with  NULL_TREE is an identity operation. That is,

Drop the first "with".

+        // If the types of the underlying templates match, compare
+        // their constraints. The declarations could differ there.
+        if (types_match)
+          types_match = equivalent_constraints (get_constraints (olddecl),
+                                                current_template_reqs);

We can't assume that current_template_reqs will always apply to newdecl here, as decls_match is called in overload resolution as well. What's the problem with attaching the requirements to the declaration before we get to duplicate_decls?

Jason


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