In different places in the C++ (C++11) standard, declarations are described in terms of derived-declarator-type-list. I am studying rvalue references and the use of this term is critical in that context (§8.3.2):
In a declaration T D where D has either of the forms
& attribute-specifier-seqopt D1
&& attribute-specifier-seqopt D1
and the type of the identifier in the declaration T D1 is
“derived-declarator-type-list T,” then the type of the identifier of D
is “derived-declarator-type-list reference to T.”
Unfortunately, the category “derived-declarator-type” is never defined in the standard. (I looked through every use of the word “derived”, and in addition this is possibly confirmed here and here.)
Because “derived-declarator-type-list” is italicized, I assume it refers to a category, and not to a variable label such as T (and therefore, I disagree with Doug Gwyn’s assessment in the second link I just gave that “we could have used X instead of ‘derived-declarator-type-list‘ “).
What is the definition of derived-declarator-type in the C++11 standard?
It’s being defined right there and then. It’s a way of carrying whatever comes before
Tacross to the next type, similar to:It’s just whatever comes before
Tin the type ofT D1.For example, if you have the declaration
int& (*const * p)[30],Tisint,Dis& (*const * p)[30]andD1is(*const * p)[30]. The type ofT D1is “pointer to const pointer to array of 30 int”. And so, according to the rule you quoted, the type ofpis “pointer to const pointer to array of 30 reference to int”.Of course, this declaration is then disallowed by §3.4.2/5:
I think the informal terminology of it being a derived declarator type list comes from the C standard’s definition of a derived type (similar to a compound type in C++):
In response to the comments: It seems you’re getting confused between the type and the declarator. For example, if
int* pis the declarator, then the type ofpis “pointer to int”. The type is expressed as these English-like sentences.Example 1:
int *(&p)[30]This is a declaration
T Dwhere (§8.3.1 Pointers):T->intD->*(&p)[3]Dhas the form:where
D1is(&p)[3]. That meansT D1is of the formint (&p)[3]which has type “reference to array of 3int” (you work this out recursively, next step using §8.3.4 Arrays and so on). Everything before theintis the derived-declarator-type-list. So we can infer thatpin our original declaration has type “reference to array of 3 pointer toint“. Magic!Example 2:
float (*(*(&e)[10])())[5]This is a declaration
T Dwhere (§8.3.4 Arrays):T->floatD->(*(*(&e)[10])())[5]Dis of the form:where
D1is(*(*(&e)[10])()). This meansT D1is of the formfloat (*(*(&e)[10])())which has type “reference to array of 10 pointer to function of () returning pointer to float” (which you work out by applying §8.3/6 and then §8.3.1 Pointers and so on). Everything before thefloatis the derived-declarator-type-list. So we can infer thatpin our original declaration has type “reference to array of 10 pointer to function of () returning pointer to array of 5 float”. Magic again!