15-01-2026, 10:41 AM
Hi,
rule 6.8.4 covers a decidable subset of rule 6.8.1.
The scope of rule 6.8.4 is limited by the phrase "explicitly designates".
I am not sure about the exact meaning of "explicitly designates" and I hope for a clarification.
Here is a list of cases I am not sure about.
I put my interpretation of "explicitly designates" as comments in the code.
All functions clearly violate the undecidable rule 6.8.1, but which functions should violate 6.8.4 too?
Thanks in advance.
rule 6.8.4 covers a decidable subset of rule 6.8.1.
The scope of rule 6.8.4 is limited by the phrase "explicitly designates".
I am not sure about the exact meaning of "explicitly designates" and I hope for a clarification.
Here is a list of cases I am not sure about.
I put my interpretation of "explicitly designates" as comments in the code.
Code:
struct A {
int m_a;
int m_b;
const int &a() const { // non-compliant - m_a as subobject explicitly designated
return m_a;
}
const int &b() const { // compliant as rule does not apply? Or is ++m_a an explicit designation of subobject m_a?
return ++m_a;
}
const int &c() const { // compliant as rule does not apply? Or is this expression an explicit designation of m_a/m_b too?
return cond ? m_a : m_b;
}
const int &d() const { // compliant as rule does not apply? calling a() somehow designates m_a, but not "explicitly", right?
return a();
}
const int *e() const { // compliant as rule does not apply as shown by examples for rule 6.8.4
const int *p = &m_a;
return p;
}
};All functions clearly violate the undecidable rule 6.8.1, but which functions should violate 6.8.4 too?
Thanks in advance.

