public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36625]  New: missing diagnostic on invalid __attribute__((aligned(N)))
@ 2008-06-24 23:43 sebor at roguewave dot com
  2008-06-24 23:48 ` [Bug c++/36625] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: sebor at roguewave dot com @ 2008-06-24 23:43 UTC (permalink / raw)
  To: gcc-bugs

[-- 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-05-04 19:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-24 23:43 [Bug c++/36625] New: missing diagnostic on invalid __attribute__((aligned(N))) sebor at roguewave dot com
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

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).