aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2019-03-15 13:56:55 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2019-03-15 13:56:55 +0000
commitca7f909fba59f79d85f74ee0846bc9ed121ba7b2 (patch)
tree161d051727d53d881f25c5dbea2f6177cdc476be /gcc/dwarf2out.c
parentd2025512b3fb357768d85ccde8e21f571481d00f (diff)
downloadgcc-ca7f909fba59f79d85f74ee0846bc9ed121ba7b2.zip
gcc-ca7f909fba59f79d85f74ee0846bc9ed121ba7b2.tar.gz
gcc-ca7f909fba59f79d85f74ee0846bc9ed121ba7b2.tar.bz2
[PR88534] accept VAR_DECL in class literal template parms
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. for gcc/ChangeLog PR c++/88534 PR c++/88537 * dwarf2out.c (generic_parameter_die): Follow DECL_INITIAL of VAR_DECL args. for gcc/testsuite/ChangeLog PR c++/88534 PR c++/88537 * g++.dg/cpp2a/pr88534.C: New. * g++.dg/cpp2a/pr88537.C: New. From-SVN: r269709
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d9cefd3..251fff7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -13603,6 +13603,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 (arg && VAR_P (arg))
+ arg = DECL_INITIAL (arg);
+
if (!parm || !DECL_NAME (parm) || !arg)
return NULL;