This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/10479] __alignof__(double) not compile time constant inside template class
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Sep 2004 15:05:42 -0000
- Subject: [Bug c++/10479] __alignof__(double) not compile time constant inside template class
- References: <20030424121601.10479.rguenth@tat.physik.uni-tuebingen.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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