diff options
author | Jason Merrill <jason@redhat.com> | 2009-11-09 13:32:53 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-11-09 13:32:53 -0500 |
commit | 0de2d392b0e7e5a9e44113ecf7f1a2e5c300333b (patch) | |
tree | c59951fc0f172dc48b6bf88d24c588bd864f437c /gcc/cp | |
parent | ff14c1f700199f7b27863f55f0e42d3066939f71 (diff) | |
download | gcc-0de2d392b0e7e5a9e44113ecf7f1a2e5c300333b.zip gcc-0de2d392b0e7e5a9e44113ecf7f1a2e5c300333b.tar.gz gcc-0de2d392b0e7e5a9e44113ecf7f1a2e5c300333b.tar.bz2 |
re PR c++/41972 (nondependent static member function as a reference template parameter fails)
PR c++/41972
* parser.c (cp_parser_template_argument): Accept SCOPE_REF around
VAR_DECL.
From-SVN: r154042
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f126a10..24da7cf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2009-11-09 Jason Merrill <jason@redhat.com> + PR c++/41972 + * parser.c (cp_parser_template_argument): Accept SCOPE_REF around + VAR_DECL. + PR c++/41994 * pt.c (tsubst_baselink): tsubst the name. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7bafb67..3475723 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11368,18 +11368,26 @@ cp_parser_template_argument (cp_parser* parser) cp_parser_abort_tentative_parse (parser); else { + tree probe; + if (TREE_CODE (argument) == INDIRECT_REF) { gcc_assert (REFERENCE_REF_P (argument)); argument = TREE_OPERAND (argument, 0); } - if (TREE_CODE (argument) == VAR_DECL) + /* If we're in a template, we represent a qualified-id referring + to a static data member as a SCOPE_REF even if the scope isn't + dependent so that we can check access control later. */ + probe = argument; + if (TREE_CODE (probe) == SCOPE_REF) + probe = TREE_OPERAND (probe, 1); + if (TREE_CODE (probe) == VAR_DECL) { /* A variable without external linkage might still be a valid constant-expression, so no error is issued here if the external-linkage check fails. */ - if (!address_p && !DECL_EXTERNAL_LINKAGE_P (argument)) + if (!address_p && !DECL_EXTERNAL_LINKAGE_P (probe)) cp_parser_simulate_error (parser); } else if (is_overloaded_fn (argument)) |