From: Argyrios Kyrtzidis Date: Sat, 8 Nov 2008 01:09:16 +0000 (+0000) Subject: In a declarator, consider an identifier a constructor only if it is followed by '('. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=99163252709b0c8334d8a49388344aaa2f0f3361;p=clang In a declarator, consider an identifier a constructor only if it is followed by '('. Previously: class C { int C; // Declarator::SetConstructor was called here. }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2b18be02a3..39d3acc0f9 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1363,7 +1363,8 @@ void Parser::ParseDirectDeclarator(Declarator &D) { // Determine whether this identifier is a C++ constructor name or // a normal identifier. if (getLang().CPlusPlus && - Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope)) + Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope) && + NextToken().is(tok::l_paren)) D.SetConstructor(Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope), Tok.getIdentifierInfo(), Tok.getLocation()); else