[c++-concepts] Constrained scope bugfix

Andrew Sutton andrew.n.sutton@gmail.com
Wed Oct 30 14:23:00 GMT 2013


Partially fixing a bug that caused lookup errors in valid programs. For example:

template<Int T, Float U>
  pair<T, U>::type void f(T, U); // Error, no such pair

When entering a template scope, we tried to match the template to one
having the same constraints. Obviously pair doesn't have Int and Float
constraints, and it probably doesn't have a partial specialization
with those constraints either.

I relaxed the fixup_template_type function so that it would just
return the looked-up type without emitting a diagnostic. This fix
makes the following a legal, however:

template<typename T>
  struct S { void f(); }

template<Int T>
  void S<T>::f() { } // Should be an error

The right solution seems to be to diagnose the error only when
defining an out-of-class member by verifying that each template scope
in the qualified name matches a declaration with the same constraints.

2013-10-30  Andrew Sutton  <andrew.n.sutton@gmail.com>
        * gcc/cp/semantics.c (fixup_template_type): Don't emit errors when
        no templates can be found with matching constraints.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugfix-4.patch
Type: text/x-patch
Size: 3128 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131030/b00a3fde/attachment.bin>


More information about the Gcc-patches mailing list