The following seems to only not work in GCC (neither MinGW nor native GCC), but it compiles fine in MSVC.

```
template<typename T>
struct A
{
    int numElements;
    T* elements;
};
template<typename T>
class B : public A<T>
{
    B(int newNumElements)
    {
numElements = newNumElements; // This fails with error.. 'numElements' was not declared in this scope; elements = new T[numElements]; // This too but with 'elements' instead of 'numElements'
    }
    ~B()
    {
        if(numElements > 0) // And so on here
        {
            delete[] elements; // And here
        }
    }
};

int main()
{
    B b(5);

    return 0;
}
```

See the comments I added to the code. Is this a bug?
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to