PR c++/88815 - narrowing conversion lost in decltype.
authorMarek Polacek <polacek@redhat.com>
Sun, 27 Jan 2019 20:19:41 +0000 (20:19 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sun, 27 Jan 2019 20:19:41 +0000 (20:19 +0000)
commitf8ec35c322fefe5609439a0dcfff0da0acbc9f72
tree303d78bfca602c2ab5f6769b662b99ffebfb6f37
parent73a54a61930af1aa355fdfb566c7a07af3a60cf8
PR c++/88815 - narrowing conversion lost in decltype.

PR c++/78244 - narrowing conversion in template not detected.
* cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
* pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
* semantics.c (finish_compound_literal): When the compound literal
isn't instantiation-dependent and the type isn't type-dependent,
fall back to the normal processing.  Set CONSTRUCTOR_IS_DEPENDENT.

* g++.dg/cpp0x/Wnarrowing15.C: New test.
* g++.dg/cpp0x/Wnarrowing16.C: New test.
* g++.dg/cpp0x/constexpr-decltype3.C: New test.
* g++.dg/cpp1y/Wnarrowing1.C: New test.

From-SVN: r268321
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/Wnarrowing15.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/Wnarrowing16.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/constexpr-decltype3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/Wnarrowing1.C [new file with mode: 0644]