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

            Bug ID: 63198
           Summary: [c++1y] decltype in template function declaration
                    yields spurious error
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eightycc at gmail dot com

Created attachment 33455
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33455&action=edit
reproduces decltype bug

Attempting to use decltype to name an argument type in a template function
declaration results in a spurious error message. For example,

// Reproduce decltype bug, condensed from Spirit X3
// gcc 4.9.1 fails to identify f1's declaration
template <typename T>
struct s1;
template <typename T>
struct s2 {
  typedef s1<T> t1;
};
template <typename T>
struct s1 {
  template <typename T2>
  s2<T> operator = (T2 const &) const;
};

struct T;
s1<T> v1;
s2<T> v2;
template <typename T>
void f1(decltype(v1 = v2)::t1);

Compiling this yields:

blackice:decltype-bug rabeles$
~/Development/gcc/gcc-4.9.1-baseline-build/gcc/cc1plus test1.cpp --std=c++1y
test1.cpp:19:30: error: variable or field ‘f1’ declared void
 void f1(decltype(v1 = v2)::t1);

Reply via email to