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: __alignof__(T) not compile time constant?


Paolo Carlini <pcarlini@unitus.it> writes:

| Gabriel Dos Reis wrote:
| 
| >The root of the disease is the same as for the PR that talks about
| > alignment in std::basic_string. I promised Paolo that I'll raise the
| > issue.  Now seems to be the time.
| >
| [snip]
| 
| Thanks Gaby.
| 
| If I understand your interesting explanations the front end should be
| fixed to have a true "C++" __alignof__.

It is not really an issue of being able to compute __alignof__.  The
issue is that of having the parser correctly digest the __aligned__
attribute.

Try

   struct A {
      enum { constant = 4 };
      __attribute__((__aligned__(constant))) char data;
   };

No template involved.

| Unfortunately, I don't think
| this is going to happen "tomorrow", right?

Well, at the moment I'm overbooked and I cannot work on attributes
right now (though I'll be interested in following any discussion/work)

We need:
  (1) to fix attributes to play nicely with C++ name lookup rules.
. (2) to be able postpone some attributes until instantiation time;
  (3) the previous point means that we are able to do meaningul
      substitution into attributes.

The above points need agreements from C++ maintainers and probably
from C maintainers since this issue also affects C/C++ compatibility.

-- Gaby


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