diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-23 22:41:47 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-23 22:41:47 +0000 |
commit | 382bc51fddbfb010b2e068bbdf94ab99811b2768 (patch) | |
tree | a3e11869468d7db13f7c46708c3a9d85f26b8bb9 /clang/lib/AST/Expr.cpp | |
parent | 620db1f3dd08ebbba71b0e16f83c11323e04bc05 (diff) | |
download | bcm5719-llvm-382bc51fddbfb010b2e068bbdf94ab99811b2768.tar.gz bcm5719-llvm-382bc51fddbfb010b2e068bbdf94ab99811b2768.zip |
PR32044: Fix some cases where we would confuse a transparent init-list expression with an aggregate init.
llvm-svn: 296033
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 366e5bf404f..c22661758c8 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1882,6 +1882,11 @@ bool InitListExpr::isTransparent() const { if (getNumInits() != 1 || !getInit(0)) return false; + // Don't confuse aggregate initialization of a struct X { X &x; }; with a + // transparent struct copy. + if (!getInit(0)->isRValue() && getType()->isRecordType()) + return false; + return getType().getCanonicalType() == getInit(0)->getType().getCanonicalType(); } |