public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48296] New: constexpr member function cannot use the class type it belongs as parameter type or return type
@ 2011-03-27  9:33 boostcpp at gmail dot com
  2011-03-28 16:21 ` [Bug c++/48296] [C++0x] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: boostcpp at gmail dot com @ 2011-03-27  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: constexpr member function cannot use the class type it
                    belongs as parameter type or return type
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: boostcpp@gmail.com


constexpr member function cannot use the class type it belongs as parameter
type or return type.
gcc issues errors for the following code.

struct X
{
    constexpr X() { }

    // error : invalid parameter type and return type.
    // same for static and non-static member function
    constexpr X f( X x ) { return x ; }
} ;

I think this is a well-formed code.

Base class name can be used.

Also gcc issues errors for the following code which I think it's caused by the
same problem.

struct X
{
    constexpr X() { }

    // declaration
    constexpr X f( X x ) ;
} ;
// definition
// error : redeclaration differs
constexpr X X::f( X x ) { return x ; }

There is no difference in the redeclaration.
So this error is wrong.


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

end of thread, other threads:[~2011-07-03 15:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-27  9:33 [Bug c++/48296] New: constexpr member function cannot use the class type it belongs as parameter type or return type boostcpp at gmail dot com
2011-03-28 16:21 ` [Bug c++/48296] [C++0x] " paolo.carlini at oracle dot com
2011-03-29  0:01 ` jason at gcc dot gnu.org
2011-03-29 13:47 ` jason at gcc dot gnu.org
2011-03-29 14:30 ` jason at gcc dot gnu.org
2011-03-29 14:33 ` jason at gcc dot gnu.org
2011-06-18  7:54 ` jb at gcc dot gnu.org
2011-07-03 15:54 ` jb 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).