Gaster, Benedict
2009-Jul-13 19:42 UTC
[LLVMdev] Clang source question around failing MSVC build
ParseDecl.cpp fails to compile with MSVC reporting the following error:
ParseDecl.cpp
compiler\llvm\tools\clang\lib\Parse\ParseDecl.cpp(2760) : error C2248:
'clang::A
STOwningResult<Destroyer>::operator =' : cannot access private member
declared i
n class 'clang::ASTOwningResult<Destroyer>'
with
[
Destroyer=::up▲
]
compiler¥llvm¥tools¥clang¥include¥clang/Parse/Ownership.h(411) : see dec
laration of 'clang::ASTOwningResult<Destroyer>::operator ='
with
[
Destroyer=::up▲
]
The problems comes with the following code:
} else if (Tok.isNot(tok::r_square)) {
// Note, in C89, this production uses the constant-expr production instead
// of assignment-expr. The only difference is that assignment-expr allows
// things like '=' and '*='. Sema rejects these in C89 mode
because they
// are not i-c-e's, so we don't need to distinguish between the two
here.
// Parse the constant-expression or assignment-expression now (depending
// on dialect).
if (getLang().CPlusPlus)
NumElements = ParseConstantExpression();
else
NumElements = ParseAssignmentExpression();
}
As far as I can tell this code should not compile because of the following code
from Ownership.h:
template <ASTDestroyer Destroyer>
class ASTOwningResult
{
…
ASTOwningResult(ASTOwningResult&); // DO NOT IMPLEMENT
ASTOwningResult& operator =(ASTOwningResult&); // DO NOT IMPLEMENT
Both the copy constructor and assignment operator are no implemented and
restricted.
A fix for this seems to be:
} else if (Tok.isNot(tok::r_square)) {
// Note, in C89, this production uses the constant-expr production instead
// of assignment-expr. The only difference is that assignment-expr allows
// things like '=' and '*='. Sema rejects these in C89 mode
because they
// are not i-c-e's, so we don't need to distinguish between the two
here.
// Parse the constant-expression or assignment-expression now (depending
// on dialect).
if (getLang().CPlusPlus)
NumElements = OwningExprResult(ParseAssignmentExpression());
else
NumElements = OwningExprResult(ParseAssignmentExpression());
}
Is this correct or have I missed something?
Many thanks,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20090713/bd3db65a/attachment.html>
Apparently Analagous Threads
- How to add a new diagnostic error message in Clang 2.6?
- [LLVMdev] [PATCH] OpenCL support - update on keywords
- [cfe-dev] trivial input provokes failed assertion in Parser.h:322
- trivial input provokes failed assertion in Parser.h:322
- Error "valor ausente TRUE/FALSE..." en doble loop FOR
