public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sebor at roguewave dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/36625]  New: missing diagnostic on invalid __attribute__((aligned(N)))
Date: Tue, 24 Jun 2008 23:43:00 -0000	[thread overview]
Message-ID: <bug-36625-1186@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

I expected to see a diagnostic for the following program regardless of whether
the template is instantiated or not, or whether the nested type is used or not.
Gcc only diagnoses the attribute when the type is used.

That said, rather than diagnosing it, it'd be even more useful to allow non
type template parameters and other constant integral expressions as arguments
to the attribute.

$ cat t.cpp && g++ t.cpp && echo PASS && g++ -DUSE_IT t.cpp
template <int N>
struct A {
    struct S { short f[3]; } __attribute__ ((aligned (N)));
};

int main ()
{
    A<123> a;
#ifdef USE_IT
    A<123>::S s;
#endif
}
PASS
t.cpp: In instantiation of ‘A<123>::S’:
t.cpp:10:   instantiated from here
t.cpp:3: error: ‘N’ was not declared in this scope
t.cpp:3: error: requested alignment is not a constant


-- 
           Summary: missing diagnostic on invalid
                    __attribute__((aligned(N)))
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


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


             reply	other threads:[~2008-06-24 23:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24 23:43 sebor at roguewave dot com [this message]
2008-06-24 23:48 ` [Bug c++/36625] " pinskia at gcc dot gnu dot org
2008-06-24 23:49 ` pinskia at gcc dot gnu dot org
2008-06-26 20:47 ` [Bug c++/36625] bogus error on __attribute__((aligned(N))) in template code sebor at roguewave dot com
2008-12-27  7:06 ` pinskia at gcc dot gnu dot org
2009-12-26 18:31 ` paolo dot carlini at oracle dot com
2009-12-26 19:13 ` paolo dot carlini at oracle dot com
2010-01-19 23:30 ` jason at gcc dot gnu dot org
2010-01-20  5:51 ` jason at gcc dot gnu dot org
2010-04-14 20:18 ` jason at gcc dot gnu dot org
2010-05-04 19:10 ` jason at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-36625-1186@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).