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

[C++ PATCH] [PR17743] attributes in typedefs are ignored


Hello,

As shown by the testcase in PR 17743, attributes in typedef declarations at
class scope are silently ignored. This appear to be a simple bug in grokfield:
TYPE_DECLs have an early exit in the middle function, but before that
attributes are processed through cplus_decl_attributes.

With this patch, some regressions appear in v3, on the new tr1::array
testcases, because of this line:

      typedef char layout_type[sizeof(_Tp)] __attribute__
((aligned(__alignof__(_Tp))));

Before, the attribute was silently ignored. Now we parse it, but we (still?) do
not support dependent types in that context, so the testcase now fails with:
libstdc++-v3/include/tr1/array:58: error: requested alignment is not a
constant. As explained in my mail for PR 10479, we do not support this
construct yet, and it is probably going to be difficult to support. Meanwhile,
the fix is to specify a very big alignment (Boost has similar code to find out
the "max" alignment needed). My patch does not modify tr1/array, I will let the
v3 guys decide on what to do.

Tested on i686-pc-linux-gnu, OK for mainline? This is another showstopper for
tr1::aligned_storage, submitted by Benjamin.

Giovanni Bajo


cp/
        PR c++/17743
        * decl2.c (grokfield): Apply attributes also to TYPE_DECLs.

testsuite/
        PR c++/17743
        * g++.dg/ext/attrib17.C: New test.

Attachment: patch-pr17743.txt
Description: Text document


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