public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59211] New: init_priority doesn't work with constant expressions
@ 2013-11-20 13:16 nyh at math dot technion.ac.il
  2013-11-20 13:34 ` [Bug c++/59211] " glisse at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: nyh at math dot technion.ac.il @ 2013-11-20 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59211
           Summary: init_priority doesn't work with constant expressions
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nyh at math dot technion.ac.il

It seems that __attribute__((init_priority(...))) demands an integer constant,
and doesn't work with constant *expressions*. For example, the following
doesn't compile:

constexpr int prio = 123;
__attribute__((init_priority(prio))) t a;

Even more sadly for me, the following attempt to avoid manually defining
priority numbers doesn't compile:

enum class init_prio : int {
    first = 101,
    second,
    third,
};
__attribute__((init_priority(init_prio::second))) t a;

There is no real reason why this shouldn't be allowed. Interestingly, with
__attribute((constructor(...)), exactly the same constructs do work!


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

end of thread, other threads:[~2014-02-03 19:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 13:16 [Bug c++/59211] New: init_priority doesn't work with constant expressions nyh at math dot technion.ac.il
2013-11-20 13:34 ` [Bug c++/59211] " glisse at gcc dot gnu.org
2013-11-20 16:00 ` nyh at math dot technion.ac.il
2013-11-21 20:59 ` daniel.kruegler at googlemail dot com
2013-11-24 23:17 ` glisse at gcc dot gnu.org
2014-02-03 19:08 ` glisse at gcc dot gnu.org
2014-02-03 19:11 ` glisse at gcc dot gnu.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).