Message ID | 8166dadf-2c22-631e-2137-600e0b26e923@oracle.com |
---|---|
State | New |
Headers | show |
Series | [C++] PR 84980 ("[concepts] ICE with missing typename in concept") | expand |
OK. And I'd say that this sort of error recovery qualifies as obvious. Jason On Fri, Aug 31, 2018 at 5:32 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote: > Hi, > > another straightforward ICE on invalid. I spent however quite a bit of time > on it, because I tried to catch the error_mark_node as early as possible, > but that doesn't seem to work well error-recovery-wise: if, say, we catch it > in deduce_constrained_parameter we end-up emitting a second redundant "‘C’ > is not a type" error message because we skip 'C' completely. Thus, at least > for the time being, I propose to simply catch the problem in > finish_shorthand_constraint (which likely avoids more ICEs already in > Bugzilla...). Tested x86_64-linux. > > Thanks, Paolo. > > //////////////////////// >
Index: cp/constraint.cc =================================================================== --- cp/constraint.cc (revision 264009) +++ cp/constraint.cc (working copy) @@ -1259,6 +1259,9 @@ finish_shorthand_constraint (tree decl, tree const if (!constr) return NULL_TREE; + if (error_operand_p (constr)) + return NULL_TREE; + tree proto = CONSTRAINED_PARM_PROTOTYPE (constr); tree con = CONSTRAINED_PARM_CONCEPT (constr); tree args = CONSTRAINED_PARM_EXTRA_ARGS (constr); Index: testsuite/g++.dg/concepts/pr84980.C =================================================================== --- testsuite/g++.dg/concepts/pr84980.C (nonexistent) +++ testsuite/g++.dg/concepts/pr84980.C (working copy) @@ -0,0 +1,6 @@ +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template<T> concept bool C = true; // { dg-error "has not been declared" } + +template<C...> struct A;