PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
authorMarek Polacek <polacek@redhat.com>
Wed, 7 Aug 2019 14:20:40 +0000 (14:20 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 7 Aug 2019 14:20:40 +0000 (14:20 +0000)
commit529bc4103b78fa16cbd93d7947724472a4ffb31e
treed4855ef69ac242d4c4342067cb9a3958413af358
parent699ce759c278cd4f8ccc4dc53f185f6d3142d990
PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.

* constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
(potential_constant_expression_1) <case ASM_EXPR>: Allow.
* cp-tree.h (finish_asm_stmt): Adjust.
* parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
use it.  Change an error to a pedwarn.  Allow asm in C++2a, warn
otherwise.
* pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
* semantics.c (finish_asm_stmt): New location_t parameter.  Use it.

* g++.dg/cpp2a/inline-asm1.C: New test.
* g++.dg/cpp2a/inline-asm2.C: New test.
* g++.dg/cpp1y/constexpr-neg1.C: Adjust dg-error.

From-SVN: r274169
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/constexpr-neg1.C
gcc/testsuite/g++.dg/cpp2a/inline-asm1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/inline-asm2.C [new file with mode: 0644]