public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug translation/50533] New: Creating object by calling constructor explicitly
@ 2011-09-27 12:52 malvikus at gmail dot com
  2011-09-27 12:59 ` [Bug c++/50533] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: malvikus at gmail dot com @ 2011-09-27 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50533
           Summary: Creating object by calling constructor explicitly
    Classification: Unclassified
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: translation
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: malvikus@gmail.com


Please, look at this debate:
http://stackoverflow.com/questions/7565776/construct-object-by-calling-constructor-method-explicitly.
I'm not expert in C++ and can't say is this bug or not. If it's bug I will add
all needed environments, versions of gcc and so on.

In general:
I can create object by calling constructor explicitly:
throw impress_errors::Error::Error(err_code); - this is compiled and work
correct on version 
g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 (Ubuntu Maverick - 10.04).
And this code failed on version 
g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 (Ubuntu Narwhal - 11.04) and 
g++ (Debian 4.6.1-13) 4.6.1 
with following error:
posix_lib.cpp: In function ‘int pos_close(int)’:
posix_lib.cpp:363:46: error: cannot call constructor
‘impress_errors::Error::Error’ directly
posix_lib.cpp:363:46: error: for a function-style cast, remove the redundant
‘::Error’


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

* [Bug c++/50533] Creating object by calling constructor explicitly
  2011-09-27 12:52 [Bug translation/50533] New: Creating object by calling constructor explicitly malvikus at gmail dot com
@ 2011-09-27 12:59 ` paolo.carlini at oracle dot com
  2011-09-27 13:35 ` redi at gcc dot gnu.org
  2011-09-27 22:13 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-27 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|malvikus at gmail dot com   |
          Component|translation                 |c++
           Severity|major                       |normal


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

* [Bug c++/50533] Creating object by calling constructor explicitly
  2011-09-27 12:52 [Bug translation/50533] New: Creating object by calling constructor explicitly malvikus at gmail dot com
  2011-09-27 12:59 ` [Bug c++/50533] " paolo.carlini at oracle dot com
@ 2011-09-27 13:35 ` redi at gcc dot gnu.org
  2011-09-27 22:13 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-27 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-27 12:59:41 UTC ---
(In reply to comment #0)
> Please, look at this debate:

No, please follow the bug reporting instructions at http://gcc.gnu.org/bugs/
and post a testcase, not a link to somewhere else.

Your case can be reduced to:


struct E {
  E(int) { }
};

int main()
{
   throw E::E(1);
}

The C++11 standard says that in this case the name E::E names the constructor
(not the class) and that 
"Such a constructor name shall be used only in the declarator-id of
a declaration that names a constructor or in a using-declaration."

So I believe your code is invalid.


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

* [Bug c++/50533] Creating object by calling constructor explicitly
  2011-09-27 12:52 [Bug translation/50533] New: Creating object by calling constructor explicitly malvikus at gmail dot com
  2011-09-27 12:59 ` [Bug c++/50533] " paolo.carlini at oracle dot com
  2011-09-27 13:35 ` redi at gcc dot gnu.org
@ 2011-09-27 22:13 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-27 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-27 21:57:07 UTC ---
Let's close this.


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

end of thread, other threads:[~2011-09-27 21:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-27 12:52 [Bug translation/50533] New: Creating object by calling constructor explicitly malvikus at gmail dot com
2011-09-27 12:59 ` [Bug c++/50533] " paolo.carlini at oracle dot com
2011-09-27 13:35 ` redi at gcc dot gnu.org
2011-09-27 22:13 ` paolo.carlini at oracle dot com

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