I changed the method by which class (and alias) template constraints
are checked. Rather than waiting until instantiation, they are now
checked after computing the binding in lookup_class template.
Actually, after the hashtable lookup so we don't re-check constraints
for previously instantiated specializations.

Previously, this was allowed:

  vector<T&>* p;

Assuming that vector restricted its arguments to only object types.
The program is ill-formed if vector<T&> is ever instantiated. This
patch causes formation of the type vector<T&> to result in an error.

Changelog:

2013-06-25  Andrew Sutton  <andrew.n.sut...@gmail.com>
        * gcc/cp/constraint.cc (check_constraints): Don't check against
        dependent arguments. Just return true.
        * gcc/cp/ptr.c (lookup_class_template_1): Check template constraints
        and diagnose failures. Removing specific check for alias templates.
        (instantiate_class_template_1): Remove constraints check during
        template instantiation.

Andrew

Attachment: class.patch
Description: Binary data

Reply via email to