History log of /llvm-project/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp (Results 26 – 50 of 53)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b576c174 04-Jan-2017 Richard Smith <richard-llvm@metafoo.co.uk>

Fix deduction of pack elements after a braced-init-list.

Previously, if the arguments for a parameter pack contained a braced-init-list,
we would abort deduction (keeping the pack deductions from pr

Fix deduction of pack elements after a braced-init-list.

Previously, if the arguments for a parameter pack contained a braced-init-list,
we would abort deduction (keeping the pack deductions from prior arguments) at
the point when we reached the braced-init-list, resulting in wrong deductions
and rejects-valids. We now just leave a "hole" in the pack for such an argument,
which needs to be filled by another deduction of the same pack.

llvm-svn: 290933

show more ...


Revision tags: llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1, llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2, llvmorg-3.9.0-rc1, llvmorg-3.8.1, llvmorg-3.8.1-rc1, llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1
# 4a09e887 09-Dec-2015 Reid Kleckner <rnk@google.com>

Fix crash on invalid initialization with std::initializer_list

It is possible for CheckListElementTypes to fail without filling in any
initializer list elements.

llvm-svn: 255176


Revision tags: llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1
# 42b10572 11-Nov-2015 Richard Smith <richard-llvm@metafoo.co.uk>

N3922: direct-list-initialization of an auto-typed variable no longer deduces a
std::initializer_list<T> type. Instead, the list must contain a single element
and the type is deduced from that.

In C

N3922: direct-list-initialization of an auto-typed variable no longer deduces a
std::initializer_list<T> type. Instead, the list must contain a single element
and the type is deduced from that.

In Clang 3.7, we warned by default on all the cases that would change meaning
due to this change. In Clang 3.8, we will support only the new rules -- per
the request in N3922, this change is applied as a Defect Report against earlier
versions of the C++ standard.

This change is not entirely trivial, because for lambda init-captures we
previously did not track the difference between direct-list-initialization and
copy-list-initialization. The difference was not previously observable, because
the two forms of initialization always did the same thing (the elements of the
initializer list were always copy-initialized regardless of the initialization
style used for the init-capture).

llvm-svn: 252688

show more ...


Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1
# 3280b330 25-Jun-2015 Hubert Tong <hubert.reinterpretcast@gmail.com>

Consolidate and unify initializer list deduction

Summary:
This patch reduces duplication in the template argument deduction code
for handling deduction from initializer lists in a function call. Thi

Consolidate and unify initializer list deduction

Summary:
This patch reduces duplication in the template argument deduction code
for handling deduction from initializer lists in a function call. This
extends the fix for PR12119 to also apply to the case where the
corresponding parameter is a trailing parameter pack.

Test Plan:
A test for deduction from nested initializer lists where the
corresponding parameter is a trailing parameter pack is added in
`clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp`.

Reviewers: fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D10681

llvm-svn: 240612

show more ...


Revision tags: llvmorg-3.6.2, llvmorg-3.6.2-rc1, llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3
# 215f423f 11-Feb-2015 Richard Smith <richard-llvm@metafoo.co.uk>

Add a warning for direct-list-initialization of a variable with a deduced type
(or of a lambda init-capture, which is sort-of such a variable). The semantics
of such constructs will change when we im

Add a warning for direct-list-initialization of a variable with a deduced type
(or of a lambda init-capture, which is sort-of such a variable). The semantics
of such constructs will change when we implement N3922, so we intend to warn on
this in Clang 3.6 then change the semantics in Clang 3.7.

llvm-svn: 228792

show more ...


Revision tags: llvmorg-3.6.0-rc2
# 1ae689c2 28-Jan-2015 Richard Smith <richard-llvm@metafoo.co.uk>

PR22367: Don't forget to create a CXXFunctionalCastExpr around
list-initialization that gets converted to some form other than an
InitListExpr. CXXTemporaryObjectExpr is a special case here, because

PR22367: Don't forget to create a CXXFunctionalCastExpr around
list-initialization that gets converted to some form other than an
InitListExpr. CXXTemporaryObjectExpr is a special case here, because it
represents a fused CXXFunctionalCastExpr + CXXConstructExpr. That, in
itself, is probably a design error...

llvm-svn: 227377

show more ...


Revision tags: llvmorg-3.6.0-rc1, llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1, llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1
# f8adcdc4 17-Jul-2014 Richard Smith <richard-llvm@metafoo.co.uk>

Track the difference between

-- a constructor list initialization that unpacked an initializer list into
constructor arguments and
-- a list initialization that created as std::initializer_lis

Track the difference between

-- a constructor list initialization that unpacked an initializer list into
constructor arguments and
-- a list initialization that created as std::initializer_list and passed it
as the first argument to a constructor

in the AST. Use this flag while instantiating templates to provide the right
semantics for the resulting initialization.

llvm-svn: 213224

show more ...


# 5332411c 16-Jul-2014 Richard Smith <richard-llvm@metafoo.co.uk>

When list-initializing an object of class type, if we pick an initializer list
constructor (and pass it an implicitly-generated std::initializer_list object),
be sure to mark the resulting constructi

When list-initializing an object of class type, if we pick an initializer list
constructor (and pass it an implicitly-generated std::initializer_list object),
be sure to mark the resulting construction as list-initialization. This fixes
an assert in template instantiation where we previously thought we'd got direct
non-list initialization without any parentheses.

llvm-svn: 213201

show more ...


# 454a7cdf 03-Jun-2014 Richard Smith <richard-llvm@metafoo.co.uk>

Implement DR990 and DR1070. Aggregate initialization initializes uninitialized
elements from {}, rather than value-initializing them. This permits calling an
initializer-list constructor or construct

Implement DR990 and DR1070. Aggregate initialization initializes uninitialized
elements from {}, rather than value-initializing them. This permits calling an
initializer-list constructor or constructing a std::initializer_list object.
(It would also permit initializing a const reference or rvalue reference if
that weren't explicitly prohibited by other rules.)

llvm-svn: 210091

show more ...


Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2, llvmorg-3.4.1-rc1, llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2
# 0449aaf3 21-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk>

PR18013: Don't assert diagnosing a bad std::initializer_list construction.

llvm-svn: 195384


Revision tags: llvmorg-3.4.0-rc1
# 4d2bbd78 06-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk>

When creating an implicit conversion sequence for a reference of type T from an
initializer list containing a single element of type T, be sure to mark the
sequence as a list conversion sequence so t

When creating an implicit conversion sequence for a reference of type T from an
initializer list containing a single element of type T, be sure to mark the
sequence as a list conversion sequence so that it is known to be worse than an
implicit conversion sequence that initializes a std::initializer_list object.

llvm-svn: 190115

show more ...


Revision tags: llvmorg-3.3.1-rc1
# cc1b96d3 12-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk>

PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an ex

PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.

llvm-svn: 183872

show more ...


Revision tags: llvmorg-3.3.0, llvmorg-3.3.0-rc3
# cd09065e 23-May-2013 Richard Smith <richard-llvm@metafoo.co.uk>

Fix crash-on-invalid if list-initialization works, but we bail out when
building the resulting expression because it invokes a deleted constructor.

llvm-svn: 182624


Revision tags: llvmorg-3.3.0-rc2, llvmorg-3.3.0-rc1
# 8c6eeb95 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk>

Replace "failed template argument deduction" diagnostic with something useful
in the one case where we've already factored out a reason code.

llvm-svn: 174036


Revision tags: llvmorg-3.2.0
# 0db1ea5f 09-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk>

Fix overload resolution for the initialization of a multi-dimensional
array from a braced-init-list. There seems to be a core wording wart
here (it suggests we should be testing whether the elements

Fix overload resolution for the initialization of a multi-dimensional
array from a braced-init-list. There seems to be a core wording wart
here (it suggests we should be testing whether the elements of the init
list are implicitly convertible to the array element type, not whether
there is an implicit conversion sequence) but our prior behavior appears
to be a bug, not a deliberate effort to implement the standard as written.

llvm-svn: 169690

show more ...


Revision tags: llvmorg-3.2.0-rc3, llvmorg-3.2.0-rc2, llvmorg-3.2.0-rc1
# e4310955 06-Nov-2012 Eli Friedman <eli.friedman@gmail.com>

Fix assertion failure with auto and nested initializer list; PR14272.

llvm-svn: 167506


# f4cc61d5 31-Jul-2012 Douglas Gregor <dgregor@apple.com>

When testing whether we can perform copy or move initialization, be
sure to supply an initialization location. Fixes <rdar://problem/11951661>.

llvm-svn: 161084


Revision tags: llvmorg-3.1.0, llvmorg-3.1.0-rc3, llvmorg-3.1.0-rc2, llvmorg-3.1.0-rc1
# 0f5c1c01 04-Apr-2012 Douglas Gregor <dgregor@apple.com>

Allow a conversion from the empty initializer list {} to an
std::initializer_list<T> so long as <T> is known. This conversion has
identity rank.

llvm-svn: 154065


# 0e60cd78 04-Apr-2012 Douglas Gregor <dgregor@apple.com>

When performing template argument deduction for an initializer list,
be sure to perform the argument type adjustments in
[temp.deduct.call]p2, e.g., array decay.

And, when performing these deduction

When performing template argument deduction for an initializer list,
be sure to perform the argument type adjustments in
[temp.deduct.call]p2, e.g., array decay.

And, when performing these deductions in the context of 'auto', make
sure that we're deducing the P' in std::initializer_list<P'> rather
than the whole initializer list.

Together, this makes code like

for( auto s : {"Deferred", "New", "Open", "Review"}) { }

work properly.

llvm-svn: 153998

show more ...


# 1918166d 15-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at>

Support deducing template arguments from nested initializer lists. PR12119.

llvm-svn: 152848


# eef474ce 22-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at>

Fix parsing and processing initializer lists in return statements and as direct member initializers.

llvm-svn: 151155


# 73cfbebe 19-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at>

Emit a warning when list-initializing a std::initializer_list member.

llvm-svn: 150933


# d74dd490 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at>

Proper initializer list support for new expressions and type construct expressions. Array new still missing.

llvm-svn: 150346


# 09edce04 23-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at>

Minor fixups for auto deduction of initializer lists.

Fix some review comments.
Add a test for deduction when std::initializer_list isn't available yet.
Fix redundant error messages. This fixes and

Minor fixups for auto deduction of initializer lists.

Fix some review comments.
Add a test for deduction when std::initializer_list isn't available yet.
Fix redundant error messages. This fixes and outstanding FIXME too.

llvm-svn: 148735

show more ...


# 42acd4a0 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at>

Auto deduction support for std::initializer_list, including for-range support. This means you can now write:

for (int i : {1, 4, 512, 23, 251}) {}

llvm-svn: 148353


123