[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#358076: ...



On Tue, Mar 21, 2006 at 05:49:43PM -0800, Steve Langasek wrote:

> Then you're obviously doing something wrong, but you haven't actually told
> us what you're doing, which makes it difficult to help you debug it.

Well, as indicated earlier, I checked the binaries of the g++ driver
versions for possible hardcoded hints to the location of the standard
headers.  There are also no id keywords in these executables.

> Please show us the commands you're running to try to build/link these
> programs, as well as the simplest C++ program for which you're seeing this
> problem.

The command that fails for finding the headers:

g++ -Wall simple.c++ -o simple

The one for dying at the linking stage (headers are located):

g++ -V 3.4 -Wall simple.c++ -o simple

where g++ is a link to g++-4.0.  Please see the attachment for the code.
I might make it even simpler but then I'd probably be the only one (again)
to complain at the gcc dev team about mangled type names from templates
returned by type_info.name() (which, as I recall, should be human readable
types, ie as we write them in the sources) but that's just to trigger the
inclusion of a standard header for an incomplete standard type that
is built into the language.

> > yet still g++-4.0 does not find them.  What's the point in having a C++
> > compiler without it's headers on a system ?
> 
> AFAIK, it's a perfectly valid use case to use g++ for compiling C++ code
> which doesn't reference the standard C++ library.

In rare cases (as in the development of standalone code) it certainly is.
The same would be valid for plain ol' C, wouldn't it ?  But then again,
I haven't seen a single C compiler distribution without a standard library
(shared object and headers) either as a prereq or directly included.  I am
sure the majority of Debian users rather hack on userland apps than
microkernels written in C++.


Regards,
Christian
#include <iostream>
#include <typeinfo>


using namespace std;



template < typename T >
struct A {

    struct B {

        typedef typename T::b_type value_type;

        B( value_type v ): value(v) {}

        operator value_type () const { return value; }

        value_type value;
    };

    typedef typename T::a_type value_type;

    A( value_type v ): value(v) {}

    operator value_type () const { return value; }

    value_type  value;
};


struct adp {

    typedef double a_type;
    typedef unsigned int b_type;
};



int main( int argc, char * argv[] )
{
    A<adp> a(-.5457);
    A<adp>::B b(8674);

    cout << typeid(a).name() << "'s size: " << sizeof(a)
         << ", value: " << a << endl;

    cout << typeid(b).name() << "'s size: " << sizeof(b)
         << ", value: " << b << endl;

    return 0;
}

Attachment: signature.asc
Description: Digital signature


Reply to: