[class.virtual] Corresponding declaration vs. overriding a virtual function CWG2496 #4699
Labels
cwg
Issue must be reviewed by CWG.
not-editorial
Issue is not deemed editorial; the editorial issue is kept open for tracking.
Please see this example
GCC prints
base
while Clang prompts an error diagnosis. In the current draft, the relevant rule is defined like that:Simultaneously, the rule for defining two declarations who correspond is defined like that:
In this example,
#1
and#2
have the same parameter-type-list,#1
has one ref-qualifier while#2
does not have, hence the latter restriction could be ignored, hence, for these two declarations, we could say they correspond. Hence,#2
overrides#1
that is declared as a virtual function. Hence, we could say both GCC and Clang have the wrong result.However, in the c++20 standard, the restriction for how to determine a declaration declared in the derived class overrides the virtual function declared in the base class is:
It's obvious that the current rule has changed its original meaning. Is it a defect in the new rule? Or, it's just the artificial design?
The text was updated successfully, but these errors were encountered: