foo bar;
foo
bar
member-declaration := ;
member-declaration := decl-specifier-seq_opt member-declarator-list_opt ;
member-declaration := empty-declaration
;
::
Foo::Foo() {}; // the constructor can be parsed as: // - Foo ::Foo(); // where the first Foo is return-type, and ::Foo is the function declarator // + Foo::Foo(); // where Foo::Foo is the function declarator
void test() { // a very slow parsing case when there are many qualifers! X::Y::Z; // The statement can be parsed as: // - X ::Y::Z; // ::Y::Z is the declarator // - X::Y ::Z; // ::Z is the declarator // + X::Y::Z; // a declaration without declarator (X::Y::Z is decl-specifier-seq) // + X::Y::Z; // a qualifed-id expression }
void foo() { // can be parsed as // - structured-binding declaration (a false parse) // - assignment expression array[index] = value; }