rsandifo-arm added a comment.

In D75572#1904415 <https://reviews.llvm.org/D75572#1904415>, @efriedma wrote:

> The planned changes to RequireCompleteType should catch this, right?  If we 
> want a specialized diagnostic for sizeless types in RequireCompleteType, we 
> should probably just pass it to RequireCompleteType.  (Otherwise, you'll end 
> up with the "wrong" diagnostic in templates.)


Yeah, the planned changes to RequireCompleteType would catch this by default.  
If RequireCompleteType should always get the first shot, I guess there are 
three possible approaches:

1. Stick with the approach in D62962 <https://reviews.llvm.org/D62962>, without 
specialised error messages.  I can break that patch up into smaller chunks if 
the general approach seems right.
2. Stick with the approach in this patch of having seperate isSizelessType 
checks and diagnostics, but test isSizelessType after RequireCompleteType 
instead of before it.  The later changes to RequireCompleteType allow sizeless 
types to be let through on demand, and the isSizelessType handling would be 
similar to the isFunctionType handling just below.
3. Like you say, stick with separate diagnostics for incomplete and sizeless 
types but make RequireCompleteType emit them both.

I guess one way doing 3. would be to use %select{incomplete|sizeless} and pass 
the result of isSizelessType() as one of the diagnostic parameters to 
RequireCompleteType.  But in some ways that feels a bit clunky because the 
caller is then doing the work to prove that the use is invalid (which it always 
is if isSizelessType()) but isn:t actually doing the work to emit the 
associated diagnostic.  Another option would be to make RequireCompleteType 
have a choice between three actions:

- the normal, standard-defined behaviour, with no special error messages for 
sizeless types.  This would remain the default if no action is explicitly 
specified.
- a mode that explicitly allows sizeless types
- a mode that explicitly disallows sizeless types, with the first diagnostic 
parameter being whether the type is sizeless or not.  In contrast to the above, 
RequireCompleteType would add this parameter automatically.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75572/new/

https://reviews.llvm.org/D75572



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to