Identifier expressions (C++ only)

An identifier expression, or id-expression, is a restricted form of primary expression. Syntactically, an id-expression requires a higher level of complexity than a simple identifier to provide a name for all of the language elements of C++.

An id-expression can be either a qualified or unqualified identifier. It can also appear after the dot and arrow operators.

Read syntax diagramSkip visual syntax diagram
Identifier expression syntax

>>-+-| unqualified_id |-+--------------------------------------><
   '-| qualified_id |---'   

unqualified_id

|--+-identifier-------------+-----------------------------------|
   +-operator_function_id---+   
   +-conversion_function_id-+   
   +-~--class_name----------+   
   '-template_id------------'   

qualified_id

|--+-::--+-identifier-----------+-------------------------------------------------------------------------------+--|
   |     +-operator_function_id-+                                                                               |   
   |     '-template_id----------'                                                                               |   
   |         .------------------------------------------.                                                       |   
   |         V                                          |                                                       |   
   '-+----+----+--------------------------------------+-+--class_or_namespace--::--+----------+--unqualified_id-'   
     '-::-'    '-class_or_namespace--::--+----------+-'                            '-template-'                     
                                         '-template-'