[cfe-dev] RFC: unreachable catch-clauses due to superclass cathes

Erik Verbruggen erikjv at me.com
Fri Jul 31 01:20:08 PDT 2009

Rolling all feedback together would give an algorithm like: 

- start with an empty list of okayed-types 
- for each handler in the AST: 
--- get the canonical type A 
--- if A is ambiguous, give a warning and continue [2] 
--- if the okayed-types list is empty, just put A in, and continue 
--- for each handler in the okayed-types list: 
------- get the canonical type B 
------- "deep check" if B is a base-class for A [1] 
------- if it is, give a warning 
------- if not, put A into the okayed-types list 

[1]: do this in a separate method, which "skips" ambiguous base-classes[2], but otherwise just recursively/iteratively walks the base-classes. This method can be changed with an improved Sema/CodeGen. 

[2]: Remaining question is if there is a utility method to check if a class is the base-class of a diamond-construct (as mentioned in AlisdairM's mail)....? 

-- Erik. 

More information about the cfe-dev mailing list