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++/12536] New: Regression regarding partial ordering


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

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

           Summary: Regression regarding partial ordering
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jhr dot walter at t-online dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

Hello,

the following program

----------
#include <iostream>

template<class T>
struct some_type {};

template<typename A>
some_type<A> foo(A const& a) {
    std::cout << "foo<A>" << std::endl;
    return some_type<A>();
}

template<typename R, typename A>
some_type<R> foo(A const& a)  {
    std::cout << "foo<R,A>" << std::endl;
    return some_type<R>();
}

template<typename A>
some_type<A> bar(A const& a, A const& = A()) {
    std::cout << "bar<A>" << std::endl;
    return some_type<A>();
}

template<typename R, typename A>
some_type<R> bar(A const& a, R const& = R())  {
    std::cout << "bar<R,A>" << std::endl;
    return some_type<R>();
}

int main() {
    foo<int>(0);
    bar<int>(0);
}

----------

outputs

----------
foo<R,A>
bar<A>
----------

when compiled with GCC 2.95.3 and

----------
foo<R,A>
bar<R,A>
----------

when compiled with GCC 3.3.1.

I believe GCC 2.95.3 is correct.

Best,
Joerg Walter

P.S.: thanks to Patrick Kowalzick, Chris Theis and Graeme Prentice.


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