aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-06-26 12:40:59 -0400
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:15:24 -0300
commit4b341beec6d47bed0e1fa6030c0c0718f5f6bdcf (patch)
treee3b96d37a7a198f51765918acb069745f8a316f8 /gcc/fortran
parent7828ff31a7cc96263bc838ebc8d6296f59ba0d12 (diff)
downloadgcc-4b341beec6d47bed0e1fa6030c0c0718f5f6bdcf.zip
gcc-4b341beec6d47bed0e1fa6030c0c0718f5f6bdcf.tar.gz
gcc-4b341beec6d47bed0e1fa6030c0c0718f5f6bdcf.tar.bz2
c++: Check uniqueness of concepts/variable templates [PR94553]
This patch wraps up PR94553. Variable template names have no C compatibility implications so they should be unique in their declarative region. It occurred to me that this applies to concepts as well. This is not specified in [basic.scope.declarative]/4.2 but that seems like a bug in the standard. I couldn't use variable_template_p because that uses PRIMARY_TEMPLATE_P which uses DECL_PRIMARY_TEMPLATE and that might not have been set up yet (push_template_decl hasn't yet been called). PRIMARY_TEMPLATE_P is important to distinguish between a variable template and a variable in a function template. But I think we don't have to worry about that in duplicate_decls: a template declaration cannot appear at block scope, and additional checks in duplicate_decls suggest that it won't ever see a TEMPLATE_DECL for a variable in a function template. So checking that the DECL_TEMPLATE_RESULT is a VAR_DECL seems to be fine. I could have added a default argument to variable_template_p too to avoid checking PRIMARY_TEMPLATE_P but it didn't seem worth the effort. gcc/cp/ChangeLog: PR c++/94553 * decl.c (duplicate_decls): Make sure a concept or a variable template is unique in its declarative region. gcc/testsuite/ChangeLog: PR c++/94553 * g++.dg/cpp1y/pr68578.C: Adjust dg-error. * g++.dg/cpp1y/var-templ66.C: New test. * g++.dg/cpp2a/concepts-redecl1.C: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions