aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-10-05 17:48:19 -0400
committerMarek Polacek <polacek@redhat.com>2020-10-06 17:35:30 -0400
commit85307b4e938d42201d6c232f5d9259f91133a303 (patch)
tree21d685bef3085640fec38d61c6077ac012f15e15 /libgomp
parenta9802204603616df14ed47d05f1b86f1bd08d8fb (diff)
downloadgcc-85307b4e938d42201d6c232f5d9259f91133a303.zip
gcc-85307b4e938d42201d6c232f5d9259f91133a303.tar.gz
gcc-85307b4e938d42201d6c232f5d9259f91133a303.tar.bz2
c++: typename in out-of-class member function definitions [PR97297]
I was notified that our P0634R3 (Down with typename) implementation has a flaw: when we have an out-of-class member function definition, we still required 'typename' for its parameters. For example here: template <typename T> struct S { int simple(T::type); }; template <typename T> int S<T>::simple(/* typename */T::type) { return 0; } the 'typename' isn't necessary per [temp.res]/5.2.4. We have a qualified name here ("S<T>::simple") so we know it's already been declared so we can look it up to see if it's a function template or a variable template. In this case, the P0634R3 code in cp_parser_direct_declarator wasn't looking into uninstantiated templates and didn't find the member function 'simple' -- cp_parser_lookup_name returned a SCOPE_REF which means that the qualifying scope was dependent. With this fix, we find the BASELINK for 'simple', don't clear CP_PARSER_FLAGS_TYPENAME_OPTIONAL from the flags, and the typename is implicitly assumed. gcc/cp/ChangeLog: PR c++/97297 * parser.c (cp_parser_direct_declarator): When checking if a name is a function template declaration for the P0634R3 case, look in uninstantiated templates too. gcc/testsuite/ChangeLog: PR c++/97297 * g++.dg/cpp2a/typename18.C: New test.
Diffstat (limited to 'libgomp')
0 files changed, 0 insertions, 0 deletions