[Bug c++/86374] New: [8 regression] template member name lookup problem

sss@li-snyder.org gcc-bugzilla@gcc.gnu.org
Mon Jul 2 13:23:00 GMT 2018


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

            Bug ID: 86374
           Summary: [8 regression] template member name lookup problem
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sss@li-snyder.org
  Target Milestone: ---

hi -

With gcc checked out on 2018-07-01 from gcc-8-branch (rev 262277,
tested on x86_64-pc-linux-gnu [fedora 28]), this input:

-- y.cc --------------------------------------------------------
template<class LIST>
struct list {
  static const int index = 1;
  template <class new_element>    struct addWithChecking {};
};

template<class list, int index = list::index>
struct find{
  static const int result = 0;
};

template <class LIST>
template<class O>
struct list<LIST>::addWithChecking<O*>
{
  static const int xres = find<list<LIST> >::result;
};
----------------------------------------------------

gives an error:

$ cc1plus -quiet -v -D_GNU_SOURCE y.cc -quiet -std=c++17
...
y.cc:16:43: error: ‘index’ is not a member of ‘list<LIST>’
   static const int xres = find<list<LIST> >::result;
                                           ^
y.cc:16:43: error: template argument 2 is invalid


This was accepted by gcc on this branch as of early June, as well as
8.1.1 20180502 and clang 6.0.0.

The error started occurring with this change:

r261460 | jason | 2018-06-11 18:01:55 -0400 (Mon, 11 Jun 2018) | 5 lines

        PR c++/85815 - reference to member of enclosing template.

        * search.c (lookup_base): Use currently_open_class.
        (lookup_member): Use it regardless of -fconcepts.
        * parser.c (cp_parser_postfix_dot_deref_expression): Check it.

thanks,
sss


More information about the Gcc-bugs mailing list