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++/10479] __alignof__(double) not compile time constant inside template class


------- Additional Comments From gdr at integrable-solutions dot net  2004-09-14 15:05 -------
Subject: Re:  __alignof__(double) not compile time constant inside template class

"rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2004-09-14 14:51 -------
| Subject: Re:  __alignof__(double) not compile time constant
|  inside template class
| 
| > To solve, this problem, one would have to redesign the name lookup
| > rules for attributes.  Or/and provide an "escaping" mechanism for the
| > compiler to follow usual language rules.
| 
| Does this "match" with that it works for non-template classes? I.e.
| 
| struct foo2 {
|         float bar __attribute__((aligned(__alignof__(double))));
| };
| 
| just works.  Remember that "double" is not a dependent type - I would

I know "double" is not dependent type.  Did you doubt that?

As I said, attributes are implemented in a way that defy language rules.  
Inside, templates, it is even worse. And tsubst() does not even look there.  

Try

     const int N = 4;

     struct S {
        enum { M = 4 };
        float ahar __attribute__((aligned(N)));
        float bhar __attribute__((aligned(M)));
     };


| certainly understand that using a dependent type would not work (or
| would be harder to do).  But not allowing non-dependent types in template
| classes doesn't look difficult (from a users point of view), are they?

Do you believe I'm against making this work?  I find it very annoying,
and happen to qualify as plain stupid.  I was just explaining what was
going on.  

Some time ago, I tried to fix that but it blew up.  It may probably be
not difficult, but it you don't try you probably won't figure it out.

-- Gaby


-- 


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


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