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

            Bug ID: 83950
           Summary: [8 regression] error: no matching function for call to
                    ‘folly::dynamic::at(size_t&) const’
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skpgkp1 at gmail dot com
                CC: hjl.tools at gmail dot com
  Target Milestone: ---

This bug appear during latest HHVM build with GCC 8. GCC 7 works fine.

$ cat AsyncLog.cpp
template <typename a, a b> struct c { static constexpr a d = b; };
template <typename> struct e : c<bool, false> {};
template <int, typename a = void> struct f { typedef a h; };
typedef int size_t;
namespace folly {
struct dynamic {
  template <class, class = void> struct g;
  dynamic(char *);
  template <class k, class = typename g<k>::h> dynamic(k);
  void at(dynamic) const;
  const dynamic *j(dynamic);
};
template <class k> struct dynamic::g<k, typename f<e<k>::d>::h> {
  using h = long;
};
}
template <class> class l;
struct m {
  folly::dynamic json;
};
template <class n> class G : l<typename n::o> { const int &p(); };
template <class n> const int &G<n>::p() {
  m jpool;
  auto json = jpool.json;
  try {
    auto jservers = json.j("");
    for (size_t i;;)
      jservers->at(i);
  } catch (int) {
  }
}


$ g++ --version
g++ (GCC) 8.0.1 20180119 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ -O3 -c AsyncLog.cpp -w
AsyncLog.cpp: In member function ‘const int& G<n>::p()’:
AsyncLog.cpp:28:21: error: no matching function for call to
‘folly::dynamic::at(size_t&) const’
       jservers->at(i);
                     ^
AsyncLog.cpp:10:8: note: candidate: ‘void folly::dynamic::at(folly::dynamic)
const’
   void at(dynamic) const;
        ^~
AsyncLog.cpp:10:8: note:   no known conversion for argument 1 from ‘size_t’
{aka ‘int’} to ‘folly::dynamic’


GCC 7 works fine:

$ g++ --version
g++ (GCC) 7.2.1 20180119
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ -O3 -c AsyncLog.cpp -w
$ echo $?
0

Reply via email to