summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-initializer-references.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix handling of initialization from parenthesized initializer list.Richard Smith2017-03-241-2/+14
| | | | | | | | | | | | | This change fixes a crash on initialization of a reference from ({}) during template instantiation and incidentally improves diagnostics. This reverts a prior attempt to handle this in r286721. Instead, we teach the initialization code that initialization cannot be performed if a source type is required and the initializer is an initializer list (which is not an expression and does not have a type), and likewise for function-style cast expressions. llvm-svn: 298676
* Use descriptive message if list initializer is incorrectly parenthesized.Serge Pavlov2016-11-121-3/+2
| | | | | | | | | | | | | If initializer contains parentheses around braced list where it is not allowed, as in construct int({0}), clang issued message like `functional-style cast from 'void' to 'int' is not allowed`, which does not help much. Both gcc and msvc issue message `list-initializer for non-class type must not be parenthesized`, which is more descriptive. This change implements similar message for clang. Differential Revision: https://reviews.llvm.org/D25816 llvm-svn: 286721
* [Sema] Do not permit binding a reference to a compound literalDavid Majnemer2015-04-261-0/+4
| | | | | | | | | We could probably make this work if we cared enough. However, we are far outside any language rules at this point. This fixes PR21834. llvm-svn: 235818
* Improve the "braces around scalar init" warning to determine whether to warnRichard Smith2015-02-121-1/+1
| | | | | | | | based on whether "redundant" braces are ever reasonable as part of the initialization of the entity, rather than whether the initialization is "top-level". In passing, add a warning flag for it. llvm-svn: 228896
* Implement the remaining portion of DR1467 from r227022. I may have ↵Larisse Voufo2015-01-271-2/+3
| | | | | | overlooked a few things, but this implementation comes straight from the DR resolution itself. llvm-svn: 227224
* PR20844: If we fail to list-initialize a reference, map to the referenced typeRichard Smith2014-09-041-0/+6
| | | | | | | | | before retrying the initialization to produce diagnostics. Otherwise, we may fail to produce any diagnostics, and silently produce invalid AST in a -Asserts build. Also add a note to this codepath to make it more clear why we were trying to create a temporary. llvm-svn: 217197
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-2/+2
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* Fix handling of braced-init-list as reference initializer within aggregateRichard Smith2013-05-311-0/+21
| | | | | | | initialization. Previously we would incorrectly require an extra set of braces around such initializers. llvm-svn: 182983
* Don't crash when binding a reference to a temporary pointer created fromRichard Smith2013-01-151-0/+7
| | | | | | | | resolving an overloaded function reference within an initializer list. Previously we would try to resolve the overloaded function reference without first stripping off the InitListExpr wrapper. llvm-svn: 172517
* PR12660: Don't crash when initializing a const reference from a braced init listRichard Smith2012-04-261-0/+5
| | | | | | which creates a temporary by calling a constructor. llvm-svn: 155608
* Be smarter in discovering list-initialization of temporaries. Fixes PR12182.Sebastian Redl2012-03-071-0/+8
| | | | llvm-svn: 152231
* Change the way we store initialization kinds so that all direct inits can ↵Sebastian Redl2012-02-121-0/+5
| | | | | | distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb. llvm-svn: 150343
* Implement overload resolution for reference-typed parameters supplied with ↵Sebastian Redl2011-12-031-0/+43
| | | | | | initializer lists. llvm-svn: 145769
* Reference initialization with initializer lists.Sebastian Redl2011-11-271-0/+31
This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists. llvm-svn: 145186
OpenPOWER on IntegriCloud