[Bug c++/12507] New: Possible regression in 3.4 or bug in 3.3.1

merkert at charter dot net gcc-bugzilla@gcc.gnu.org
Sat Oct 4 13:22:00 GMT 2003


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

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

           Summary: Possible regression in 3.4 or bug in 3.3.1
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: merkert at charter dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: g++ (GCC) 3.4 20031001 (experimental)

This code here will compiles with 3.3.1, but fails to compile with 3.4. It's
possible that the code is actually incorrect and 3.3.1 should not compile it, so
I don't know if it's a regression. I'd say 3.3.1 gets it wrong.

cat > test.cpp <<EOF
#include <cstdio>

template <class T> struct A {

  template <class U> A (const U& u)
  {
    _a = dynamic_cast<const T&>(u);
    ::std::printf("1\n");
  }

  T _a;
};

struct  B {
  virtual ~B() {}
};
struct C : public virtual B
{
  ~C() {}
};

typedef A<C> Ac;

int main()
{
  C c;
  B& b = c;
  Ac<B> a(b); // only compiles with 3.3.1
// Ac::A<B> a(b)   compils with both, 3.4 and 3.3.1
  return 0;
}
EOF



More information about the Gcc-bugs mailing list