This is the mail archive of the gcc@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]

Re: c++0x {g++}4.4, =default definition outside template class fails{ to link}.


Sorry Paolo, that definitely should have been.

=== THIS CODE FAILS TO LINK ===
template <typename T>
class foo {
  public:
    foo() =default; // <<--- this works fine.
    ~foo();
};

template <typename T>
foo<T>::~foo() =default; <<--- ERROR: This doesn't get built by the compiler.
// foo<T>::~foo() {}; <<-- replacing with this line fixes the error.

int main() {

    foo<int> fi;

    return 0;
}
===================

Not
=== THIS CODE FAILS TO COMPILE ===
...


Still, shouldn't the <int> version of
"foo<T>::~foo() =default;"
be built by the compiler since it's called by main().

Is this a bug? Should I update my gcc and go retest?
Does it fail to link for you? (or anyone else)?


Also, yes I am using a snapshot, I couldn't figure out how to get the
mainline (trunk?) 4.4 version, all I got was 4.3 using svn. Then again
I'm new to svn and building gcc.


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