public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails
@ 2020-04-27 13:57 ojman101 at protonmail dot com
  2020-04-27 15:53 ` [Bug c++/94799] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: ojman101 at protonmail dot com @ 2020-04-27 13:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

            Bug ID: 94799
           Summary: [7.2+ Regression] Calling a member template function
                    fails
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ojman101 at protonmail dot com
  Target Milestone: ---

>From gcc version 7.2 and upwards this c++ code, using a member template
function look-up, fails to compile:

template <typename T>
struct A {
    int a() {
        return 42;
    }
};

template <typename T>
struct B {
    int b(A<T> *p) {
        return p->template A<T>::a();
    }
};

int main() {
    A<int> a;
    B<int> b;
    return b.b(&a);
}

On gcc version 9.3.0 (Gentoo 9.3.0 p2), this output is generated:

main.cc: In member function 'int B<T>::b(A<T>*)':
main.cc:11:32: error: expected ';' before '::' token
   11 |         return p->template A<T>::a();
      |                                ^~
      |                                ;
main.cc:11:34: error: '::a' has not been declared
   11 |         return p->template A<T>::a();
      |                                  ^
main.cc: In instantiation of 'int B<T>::b(A<T>*) [with T = int]':
main.cc:18:18:   required from here
main.cc:11:28: error: 'A' is not a member template function
   11 |         return p->template A<T>::a();
      |                ~~~~~~~~~~~~^~~~

This code successfully compiles on new versions of clang, icc and msvc as well
as gcc versions before 7.2.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
@ 2020-04-27 15:53 ` mpolacek at gcc dot gnu.org
  2020-04-27 15:58 ` mpolacek at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-27 15:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |6.4.0
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
            Summary|[7.2+ Regression] Calling a |[8/9/10 Regression]
                   |member template function    |Regression] Calling a
                   |fails                       |member template function
                   |                            |fails
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2020-04-27
   Target Milestone|---                         |8.5
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with

commit 1e5f79b61994f8ffccad62a58031f5937aa16ae3
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Jun 28 15:41:36 2017 -0400

    PR c++/54769 - wrong lookup of dependent template-name.

            * parser.c (cp_parser_template_name): Handle dependent object type.
            (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
            parameter.
            (cp_parser_id_expression): Pass it.
            (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.

    From-SVN: r249752

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
  2020-04-27 15:53 ` [Bug c++/94799] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
@ 2020-04-27 15:58 ` mpolacek at gcc dot gnu.org
  2020-04-27 16:34 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-27 15:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Relevant threads:
https://gcc.gnu.org/pipermail/gcc-patches/2017-June/478011.html
https://gcc.gnu.org/pipermail/gcc-patches/2017-June/478247.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
  2020-04-27 15:53 ` [Bug c++/94799] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
  2020-04-27 15:58 ` mpolacek at gcc dot gnu.org
@ 2020-04-27 16:34 ` rguenth at gcc dot gnu.org
  2020-04-27 19:24 ` [Bug c++/94799] [8/9/10 " mpolacek at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-27 16:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (2 preceding siblings ...)
  2020-04-27 16:34 ` rguenth at gcc dot gnu.org
@ 2020-04-27 19:24 ` mpolacek at gcc dot gnu.org
  2020-04-28  0:51 ` mpolacek at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-27 19:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Here we have "p->template A<T>::a()" but cp_parser_expression only parses the
"p->template A<T>" part, so we complain that a ; isn't following.

It's because cp_parser_template_name now considers the object scope:

16957       if (template_keyword_p)
16958         {
16959           tree scope = (parser->scope ? parser->scope
16960                         : parser->context->object_type);
16961           if (scope && TYPE_P (scope)
16962               && (!CLASS_TYPE_P (scope) 
16963                   || (check_dependency_p && dependent_type_p (scope))))
16964             {
16965               /* We're optimizing away the call to cp_parser_lookup_name,
but
16966                  we still need to do this.  */
16967               parser->context->object_type = NULL_TREE;
16968               return identifier;
16969             }
16970         }

which here is unknown_type_node, signalling a type-dependent object:

 7756   if (dependent_p)
 7757     /* Tell cp_parser_lookup_name that there was an object, even though
it's
 7758        type-dependent.  */
 7759     parser->context->object_type = unknown_type_node;

so now cp_parser_template_name returns identifier 'A', cp_parser_class_name
creates a TEMPLATE_ID_EXPR A<T>, but then

23735       decl = make_typename_type (scope, decl, tag_type, tf_error);

fails because scope is NULL -- we've used the object scope instead.  We
probably have to look that up first.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (3 preceding siblings ...)
  2020-04-27 19:24 ` [Bug c++/94799] [8/9/10 " mpolacek at gcc dot gnu.org
@ 2020-04-28  0:51 ` mpolacek at gcc dot gnu.org
  2020-04-28 23:43 ` mpolacek at gcc dot gnu.org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-28  0:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another test, where the name after . isn't an injected-class-name:

template<typename T> struct B {
  void foo ();
  int i;
};

template<typename T>
struct D : public B<T> { };

template<typename T>
void fn (D<T> d)
{
  d.template B<T>::foo ();
  d.template B<T>::i = 42;
}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (4 preceding siblings ...)
  2020-04-28  0:51 ` mpolacek at gcc dot gnu.org
@ 2020-04-28 23:43 ` mpolacek at gcc dot gnu.org
  2020-04-29  4:11 ` mpolacek at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-28 23:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Finally I have something that seems to work...

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (5 preceding siblings ...)
  2020-04-28 23:43 ` mpolacek at gcc dot gnu.org
@ 2020-04-29  4:11 ` mpolacek at gcc dot gnu.org
  2020-05-05 14:19 ` [Bug c++/94799] [8/9/10/11 " cvs-commit at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-29  4:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544806.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10/11 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (6 preceding siblings ...)
  2020-04-29  4:11 ` mpolacek at gcc dot gnu.org
@ 2020-05-05 14:19 ` cvs-commit at gcc dot gnu.org
  2020-05-05 14:21 ` [Bug c++/94799] [8/9/10 " mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-05 14:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:ef3479afc5ab415f00a53fc6f6a990df7f6a0747

commit r11-86-gef3479afc5ab415f00a53fc6f6a990df7f6a0747
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Apr 28 22:30:44 2020 -0400

    c++: Member template function lookup failure [PR94799]

    Whew, this took a while.  We fail to parse "p->template A<T>::a()"
    (where p is of type A<T> *) because since r249752 we treat the RHS of the
->
    as dependent and avoid a lookup in the enclosing context: since that rev
    cp_parser_template_name checks parser->context->object_type too, which
    here is unknown_type_node, signalling a type-dependent object:

     7756   if (dependent_p)
     7757     /* Tell cp_parser_lookup_name that there was an object, even
though it's
     7758        type-dependent.  */
     7759     parser->context->object_type = unknown_type_node;

    with which cp_parser_template_name returns identifier 'A',
cp_parser_class_name
    then creates a TEMPLATE_ID_EXPR A<T>, but then

    23735       decl = make_typename_type (scope, decl, tag_type, tf_error);

    in cp_parser_class_name fails because scope is NULL.  Then we return
    error_mark_node and parse errors ensue.

    I've tried various approaches, e.g. keeping TEMPLATE_ID_EXPR around
    instead of calling make_typename_type, which didn't work, whereupon I
    realized that since we don't want to perform name lookup if we've seen
    the template keyword and the scope is dependent, we can adjust
    parser->context->object_type and use the type of the object expression
    as the scope, even if it's type-dependent.  This should be in line with
    [basic.lookup.classref]p4.  If the postfix expression doesn't have a type,
    use typeof to carry its type.  This typeof will be processed in
    tsubst/TYPENAME_TYPE.

            PR c++/94799
            * parser.c (cp_parser_postfix_dot_deref_expression): If we have
            a type-dependent object of class type, stash it to
            parser->context->object_type.  If the postfix expression doesn't
have
            a type, use typeof.
            (cp_parser_class_name): Consider object scope too.
            (cp_parser_lookup_name): Remove code dealing with the case when
            object_type is unknown_type_node.

            * g++.dg/lookup/this1.C: Adjust dg-error.
            * g++.dg/template/lookup12.C: New test.
            * g++.dg/template/lookup13.C: New test.
            * g++.dg/template/lookup14.C: New test.
            * g++.dg/template/lookup15.C: New test.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (7 preceding siblings ...)
  2020-05-05 14:19 ` [Bug c++/94799] [8/9/10/11 " cvs-commit at gcc dot gnu.org
@ 2020-05-05 14:21 ` mpolacek at gcc dot gnu.org
  2020-05-15  9:52 ` reichelt at gcc dot gnu.org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-05 14:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10/11 Regression]      |[8/9/10 Regression] Calling
                   |Calling a member template   |a member template function
                   |function fails              |fails

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.  I plan to backport it to 10.2, maybe 9 too.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (8 preceding siblings ...)
  2020-05-05 14:21 ` [Bug c++/94799] [8/9/10 " mpolacek at gcc dot gnu.org
@ 2020-05-15  9:52 ` reichelt at gcc dot gnu.org
  2020-05-15 12:43 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: reichelt at gcc dot gnu.org @ 2020-05-15  9:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu.org

--- Comment #9 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Hi Marek,

your fix unfortunately breaks the following valid code (reduced from pybind11):

=======================================================
template <typename> struct A
{
  typedef int type;
  operator int();
};

template <typename T> using B = A<T>;

template <typename T> typename B<T>::type foo(B<T> b)
{
  return b.operator typename B<T>::type();
}

void bar()
{
  foo(A<int>());
}
=======================================================

bug.cc: In instantiation of 'typename B<T>::type foo(B<T>) [with T = int;
typename B<T>::type = int; B<T> = A<int>; B<T> = A<int>]':
bug.cc:16:15:   required from here
bug.cc:11:36: error: no type named 'B' in 'struct A<int>'
   11 |   return b.operator typename B<T>::type();
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (9 preceding siblings ...)
  2020-05-15  9:52 ` reichelt at gcc dot gnu.org
@ 2020-05-15 12:43 ` mpolacek at gcc dot gnu.org
  2020-08-17 10:10 ` reichelt at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-15 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I see :(.  I'll take a look, thanks for noticing.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (10 preceding siblings ...)
  2020-05-15 12:43 ` mpolacek at gcc dot gnu.org
@ 2020-08-17 10:10 ` reichelt at gcc dot gnu.org
  2020-08-17 17:32 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: reichelt at gcc dot gnu.org @ 2020-08-17 10:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #11 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Hi Marek, any news on this one? It's three months now...
Or should I file a new bug for the regression on trunk?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (11 preceding siblings ...)
  2020-08-17 10:10 ` reichelt at gcc dot gnu.org
@ 2020-08-17 17:32 ` mpolacek at gcc dot gnu.org
  2020-10-19 21:03 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-17 17:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Volker Reichelt from comment #11)
> Hi Marek, any news on this one? It's three months now...
> Or should I file a new bug for the regression on trunk?

No news yet.  I've been largely away from upstream GCC for the past two months,
but I should have more time now.  I hope this will be fixed within the next
couple of weeks.  Sorry it's taking so long.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (12 preceding siblings ...)
  2020-08-17 17:32 ` mpolacek at gcc dot gnu.org
@ 2020-10-19 21:03 ` mpolacek at gcc dot gnu.org
  2020-10-20  0:53 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-19 21:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #13 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The fix may be as easy as this:

--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -23812,8 +23812,8 @@ cp_parser_class_name (cp_parser *parser,

   /* Any name names a type if we're following the `typename' keyword
      in a qualified name where the enclosing scope is type-dependent.  */
-  typename_p = (typename_keyword_p && scope && TYPE_P (scope)
-       && dependent_type_p (scope));
+  typename_p = (typename_keyword_p && parser->scope && TYPE_P (parser->scope)
+       && dependent_type_p (parser->scope));
   /* Handle the common case (an identifier, but not a template-id)
      efficiently.  */
   if (token->type == CPP_NAME

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (13 preceding siblings ...)
  2020-10-19 21:03 ` mpolacek at gcc dot gnu.org
@ 2020-10-20  0:53 ` mpolacek at gcc dot gnu.org
  2020-10-24 18:25 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-20  0:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #14 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2020-October/556517.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (14 preceding siblings ...)
  2020-10-20  0:53 ` mpolacek at gcc dot gnu.org
@ 2020-10-24 18:25 ` mpolacek at gcc dot gnu.org
  2020-10-28 19:26 ` cvs-commit at gcc dot gnu.org
  2020-10-28 19:27 ` mpolacek at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-24 18:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |martin@mpa-garching.mpg.de

--- Comment #15 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 97564 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (15 preceding siblings ...)
  2020-10-24 18:25 ` mpolacek at gcc dot gnu.org
@ 2020-10-28 19:26 ` cvs-commit at gcc dot gnu.org
  2020-10-28 19:27 ` mpolacek at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-28 19:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:323dd4255203479d8c456b85513db4f8e0041d04

commit r11-4499-g323dd4255203479d8c456b85513db4f8e0041d04
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Oct 19 18:13:42 2020 -0400

    c++: Member template function lookup failure [PR94799]

    My earlier patch for this PR, r11-86, broke pybind11.  That patch
    changed cp_parser_class_name to also consider the object expression
    scope (parser->context->object_type) to fix parsing of

      p->template A<T>::foo(); // consider p's scope too

    Here we reject

      b.operator typename B<T>::type();

    because 'typename_p' in cp_parser_class_name uses 'scope', which means
    that 'typename_p' will be true for the example above.  Then we create
    a TYPENAME_TYPE via make_typename_type, which fails when tsubsting it;
    the code basically created 'typename B::B' and then we complain that there
    is no member named 'B' in 'A<int>'.  So, when deciding if we should
    create a TYPENAME_TYPE, don't consider the object_type scope, like we
    did pre-r11-86.

    gcc/cp/ChangeLog:

            PR c++/94799
            * parser.c (cp_parser_class_name): Use parser->scope when
            setting typename_p.

    gcc/testsuite/ChangeLog:

            PR c++/94799
            * g++.dg/template/lookup16.C: New test.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/94799] [8/9/10 Regression] Calling a member template function fails
  2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
                   ` (16 preceding siblings ...)
  2020-10-28 19:26 ` cvs-commit at gcc dot gnu.org
@ 2020-10-28 19:27 ` mpolacek at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-28 19:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #17 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Should be fixed now.  Sorry it took so long.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-10-28 19:27 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 13:57 [Bug c++/94799] New: [7.2+ Regression] Calling a member template function fails ojman101 at protonmail dot com
2020-04-27 15:53 ` [Bug c++/94799] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
2020-04-27 15:58 ` mpolacek at gcc dot gnu.org
2020-04-27 16:34 ` rguenth at gcc dot gnu.org
2020-04-27 19:24 ` [Bug c++/94799] [8/9/10 " mpolacek at gcc dot gnu.org
2020-04-28  0:51 ` mpolacek at gcc dot gnu.org
2020-04-28 23:43 ` mpolacek at gcc dot gnu.org
2020-04-29  4:11 ` mpolacek at gcc dot gnu.org
2020-05-05 14:19 ` [Bug c++/94799] [8/9/10/11 " cvs-commit at gcc dot gnu.org
2020-05-05 14:21 ` [Bug c++/94799] [8/9/10 " mpolacek at gcc dot gnu.org
2020-05-15  9:52 ` reichelt at gcc dot gnu.org
2020-05-15 12:43 ` mpolacek at gcc dot gnu.org
2020-08-17 10:10 ` reichelt at gcc dot gnu.org
2020-08-17 17:32 ` mpolacek at gcc dot gnu.org
2020-10-19 21:03 ` mpolacek at gcc dot gnu.org
2020-10-20  0:53 ` mpolacek at gcc dot gnu.org
2020-10-24 18:25 ` mpolacek at gcc dot gnu.org
2020-10-28 19:26 ` cvs-commit at gcc dot gnu.org
2020-10-28 19:27 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).