https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49070
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid CC| |egallager at gcc dot gnu.org Known to work| |4.0.1, 4.1.2 Known to fail| |4.7.0, 8.0 --- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> --- Output with gcc trunk: $ /usr/local/bin/g++ -c 49070.mm 49070.mm: In function ‘objc_object* function(A*)’: 49070.mm:10:21: error: found ‘:’ in nested-name-specifier, expected ‘::’ return [x method:x :x]; ^ :: 49070.mm:10:19: warning: ‘A’ may not respond to ‘-method:’ return [x method:x :x]; ^ 49070.mm:10:19: warning: (Messages without a matching method signature 49070.mm:10:19: warning: will be assumed to return ‘id’ and accept 49070.mm:10:19: warning: ‘...’ as arguments.) 49070.mm:10:12: error: expected ‘,’ before ‘method’ return [x method:x :x]; ^~~~~~ 49070.mm:10:12: error: ‘method’ was not declared in this scope 49070.mm:10:18: error: expected ‘,’ before ‘:’ token return [x method:x :x]; ^ 49070.mm:10:18: error: expected identifier before ‘:’ token 49070.mm: In lambda function: 49070.mm:10:24: error: expected ‘{’ before ‘;’ token return [x method:x :x]; ^ 49070.mm: In function ‘objc_object* function(A*)’: 49070.mm:10:24: error: cannot convert ‘function(A*)::<lambda()>’ to ‘objc_object*’ in return I also checked with an older version of g++ (Apple's 4.0.1) and can confirm that the older version compiled it successfully.