This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12672] Evals template defaults args that it should not


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12672


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-10-18 19:47:24
               date|                            |


------- Additional Comments From bangerth at dealii dot org  2003-10-18 19:47 -------
Confirmed. Here's something even shorter:
---------------------------
template <typename T> struct S {
    typedef typename T::type type;
};

template<typename U, typename V = typename S<U>::type>
struct A {};

template<typename T> A<T> Foo(T);
template<typename T> void Foo(T, T);

int main() {
  Foo<int>(1, 2);
}
----------------------------
This fails to compile because the compiler tries to instantiate
the return type of the first Foo function. Whether that is actually
taken is irrelevant here, since we are only doing name lookup at this
stage, but we shouldn't error out: this is a SFINAE failure and
should just remove the first Foo function from the list of candidates.
It shouldn't be an error.

I confirm this for 3.3 and 3.4 builds from 2003-09-19, since this is
the latest I presently have. They both say
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In instantiation of `S<int>':
x.cc:12:   instantiated from here
x.cc:2: error: `int' is not a class, struct, or union type

What startles me a bit is that icc7 also shows the error. I am pretty sure,
though, that this is in error as well.

W.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]