[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: Re: [cfe-commits] [PATCH] Fix copy-list-initialization in template instantiation.
From: Richard Smith <richard () metafoo ! co ! uk>
Date: 2012-12-19 1:50:17
Message-ID: CAOfiQqkwVVjZLWg6cBAUeq1uLNZzLK3Gxmb=i9H+K8MfMEdKBw () mail ! gmail ! com
[Download RAW message or body]
On Mon, Dec 17, 2012 at 5:28 AM, Olivier Goffart <ogoffart@kde.org> wrote:
> On Monday 10 December 2012 10:44:37 Olivier Goffart wrote:
>> Hi,
>>
>> Attached you will find a suggested fix for
>> http://llvm.org/bugs/show_bug.cgi?id=14486 and
>> http://llvm.org/bugs/show_bug.cgi?id=13470
>
> Ping?
+ if (VDecl->isInvalidDecl()) {
+ } else if (DirectInit && isa<CXXConstructExpr>(Init)) {
+ //We already have performed the initialisation
+ assert(cast<CXXConstructExpr>(Init)->getType() == DclT);
This doesn't look correct; the Init could be a CXXTemporaryObjectExpr.
+ if (getLangOpts().CPlusPlus0x && !DirectInit && isa<InitListExpr>(Init)
+ && !isa<InitListExpr>(Result.get())) {
+ // Remember this was a copy-list-initialization
+ VDecl->setInitStyle(VarDecl::ListInit);
This isn't acceptable: ListInit means direct-list-initialization.
// source type is the same class as, or a derived class of, the
// class of the destination, constructors are considered. [...]
if (Kind.getKind() == InitializationKind::IK_Direct ||
+ Kind.getKind() == InitializationKind::IK_DirectList ||
(Kind.getKind() == InitializationKind::IK_Copy &&
(Context.hasSameUnqualifiedType(SourceType, DestType) ||
S.IsDerivedFrom(SourceType, DestType))))
This looks wrong: list initialization is handled by the first bullet
of [dcl.init]p17, and this is the seventh bullet. We should never get
here for list initialization.
I've fixed this a different way in r170489.
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic