On 3/14/19 4:20 PM, Marek Polacek wrote:
On Thu, Mar 14, 2019 at 05:14:49PM -0300, Alexandre Oliva wrote:
P0732R2 / C++ 2a introduce class literals as template parameters. The
front-end uses VAR_DECLs constructed from such literals to bind the
template PARM_DECLs, but dwarf2out.c used to reject such VAR_DECLs.
Taking DECL_INITIAL from such VAR_DECLs enables the generation of
DW_AT_const_value for them, at least when the class literal can
actually be represented as such.
Regstrapped on x86_64- and i686-linux-gnu. Ok to install?
for gcc/ChangeLog
PR c++/88534
PR c++/88537
* dwarf2out.c (generic_parameter_die): Follow DECL_INITIAL of
VAR_DECL args.
for gcc/ChangeLog
PR c++/88534
PR c++/88537
* g++.dg/cpp2a/pr88534.C: New.
* g++.dg/cpp2a/pr88537.C: New.
---
gcc/dwarf2out.c | 7 ++++
gcc/testsuite/g++.dg/cpp2a/pr88534.C | 65 ++++++++++++++++++++++++++++++++++
gcc/testsuite/g++.dg/cpp2a/pr88537.C | 16 ++++++++
3 files changed, 88 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/cpp2a/pr88534.C
create mode 100644 gcc/testsuite/g++.dg/cpp2a/pr88537.C
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 8305555681447..478d9b9b289b1 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -13601,6 +13601,13 @@ generic_parameter_die (tree parm, tree arg,
dw_die_ref tmpl_die = NULL;
const char *name = NULL;
+ /* C++2a accepts class literals as template parameters, and var
+ decls with initializers represent them. The VAR_DECLs would be
+ rejected, but we can take the DECL_INITIAL constructor and
+ attempt to expand it. */
+ if (TREE_CODE (arg) == VAR_DECL)
You can use VAR_P for this.
OK with that change.
Jason