public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12246] New: __attribute__ not able to be placed on inline ctors
@ 2003-09-11 14:54 Bruce at Fitzsimons dot org
  2003-09-11 14:54 ` [Bug c++/12246] " Bruce at Fitzsimons dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bruce at Fitzsimons dot org @ 2003-09-11 14:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: __attribute__ not able to be placed on inline ctors
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Bruce at Fitzsimons dot org
                CC: gcc-bugs at gcc dot gnu dot org

__attribute__ attributes are not able to be placed on inline ctors, which is a
bit frustrating.

Sometimes inline ctors are used in header files, esp. when doing a thin layer of
inheritance around an existing object ie only the base class needs
initialisation, there are no new member variables. 

This is often the case for deriving exceptions, where a new type is desired (for
specific catch'es) but no new methods or members are defined.

A simple example (not the inheritance case)

class A
{
public:
    A(int _anInt)  __attribute__ ((deprecated)) { anInt = _anInt; }
private:
    int anInt;
};

int main(void) {
    A aInstance(42);
}

Fails to parse:
g++ test.cc
test.cc:4: syntax error before `{' token
test.cc:5: semicolon missing after declaration of `A'
test.cc: In function `int main()':
test.cc:10: no matching function for call to `A::A(int)'
test.cc:2: candidates are: A::A(const A&)


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

end of thread, other threads:[~2004-01-01  1:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-11 14:54 [Bug c++/12246] New: __attribute__ not able to be placed on inline ctors Bruce at Fitzsimons dot org
2003-09-11 14:54 ` [Bug c++/12246] " Bruce at Fitzsimons dot org
2003-09-11 14:54 ` [Bug c++/12246] __attribute__ not allowed in member function definition bangerth at dealii dot org
2003-09-12  2:13 ` Bruce at Fitzsimons dot org
2003-09-12  2:16 ` Bruce at Fitzsimons dot org
2004-01-01  1:42 ` pinskia 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).