Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

c++ - What do they mean by the sentence "is used to identify the subject of an elaborated-type-specifier" in [dcl.typedef]/8?

[dcl.typedef]/8

A simple-template-id is only a typedef-name if its template-name names an alias template or a template template-parameter. [Note 1: A simple-template-id that names a class template specialization is a class-name ([class.name]). If a typedef-name is used to identify the subject of an elaborated-type-specifier ([dcl.type.elab]), a class definition, a constructor declaration, or a destructor declaration, the program is ill-formed. — end note]

[Example 8:

struct S {
    S();
    ~S();
};

typedef struct S T;

S a = T();                      // OK
struct T * p;                   // error

— end example]

I presume the sentence highlighted above explains the error. But I'm not sure I understand what do they mean by that sentence.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...