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

            Bug ID: 65415
           Summary: using, base class static member function template, and
                    decltype
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com

>From http://stackoverflow.com/questions/29013260.

Minimized repro:

struct default_check
{ 
  template<typename U> static int check(...);
};

struct is_addable : default_check
{
  using default_check::check; // #1
  using type = decltype(check<void>(0));
};

int main() {}

gcc HEAD 5.0.0 20150312 (experimental) reports

prog.cc:9:31: error: expected primary-expression before 'void'
  using type = decltype(check<void>(0));
                              ^
prog.cc:9:31: error: expected ')' before 'void'
prog.cc:9:16: error: expected type-specifier before 'decltype'
  using type = decltype(check<void>(0));
               ^

i.e., for some reason the `check` brought in by `using` isn't found. Oddly
enough, commenting out line #1 makes the code compile.

(The original code in the linked SO question had a separate check() overload in
is_addable. In that case, lookup for some reason only found the is_addable
overload and not the base class one brought in by `using`)

Reply via email to