public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return
@ 2010-12-31  6:49 yacwroy at gmail dot com
  2010-12-31 14:40 ` [Bug c++/47132] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: yacwroy at gmail dot com @ 2010-12-31  6:49 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: decltype can't deduce some operator return types when
                    defining an auto function's return
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: yacwroy@gmail.com
             Build: 168358 (patched, see specs)


Created attachment 22873
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22873
Erroneously fails to compile.

An error is generated when:
a) A template function whose return type is auto is being instantiated.
b) The function's return type is deduced via decltype.
c) The decltype expression is a compound operator (such as |=).

The error is: "sorry, unimplemented: mangling modop_expr". (Are "sorry,
unimplemented" errors already on todo lists?)

The operator parameters don't seem to matter - they can be literals, globals,
function parameters.

Compilation fails even if the function takes no arguments and the template
parameters are explicit.

The decltype only fails if used to define a function return type. An identical
decltype within the function body compiles OK and can be used to define
variables.

A non-template equivalent function compiles OK.

Only fails to compile if the function is actually instantiated.


As far as I can read there's no legitimate reason for this failure, although I
could've missed something.
And on the off chance that it should legitimately fail, the error message needs
updating.



Example code is attached. It is as trivial as I could get.

Example Output:
../test/gcc-bug-mangling_modop-1.cpp: In instantiation of ‘decltype (x
bit_ior_expr1) foo() [with tTYPE = int, decltype (x bit_ior_expr1) = int&]’:
../test/gcc-bug-mangling_modop-1.cpp:18:12:   instantiated from here
../test/gcc-bug-mangling_modop-1.cpp:6:1: sorry, unimplemented: mangling
modop_expr



I searched the bug repository for "modop_expr" and got 0 hits.



Specs:
GCC: 4.6.0 20101230 (experimental) 
  - D/L via SVN on 31st Dec 2010.
  - Build: 168358 (Trunk).
  - Patched with Pedro Lamarao's "Delegating constructors" patch
(http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00620.html).
    - This shouldn't affect anything here.
System:
  - Ubuntu 10.10 (x86-64).
  - Intel Core2 Duo.


Hope this helps,
Simon.


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

* [Bug c++/47132] decltype can't deduce some operator return types when defining an auto function's return
  2010-12-31  6:49 [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return yacwroy at gmail dot com
@ 2010-12-31 14:40 ` redi at gcc dot gnu.org
  2011-05-27 17:46 ` [Bug c++/47132] [C++0x] " jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-31 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.31 14:40:05
     Ever Confirmed|0                           |1
              Build|168358 (patched, see specs) |

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-31 14:40:05 UTC ---
confirmed, not a regression

N.B. the Build field is for the value used for --build at configure time, e.g.
--build=i686-unknown-linux-gnu, not the svn revision.  That would be shown if
you included the output of 'gcc -v' as requested in the bug reporting
guidelines, although in this case the unimplemented feature is not dependent on
any configure options.


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

* [Bug c++/47132] [C++0x] decltype can't deduce some operator return types when defining an auto function's return
  2010-12-31  6:49 [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return yacwroy at gmail dot com
  2010-12-31 14:40 ` [Bug c++/47132] " redi at gcc dot gnu.org
@ 2011-05-27 17:46 ` jason at gcc dot gnu.org
  2011-05-27 19:36 ` jason at gcc dot gnu.org
  2011-05-27 20:47 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c++/47132] [C++0x] decltype can't deduce some operator return types when defining an auto function's return
  2010-12-31  6:49 [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return yacwroy at gmail dot com
  2010-12-31 14:40 ` [Bug c++/47132] " redi at gcc dot gnu.org
  2011-05-27 17:46 ` [Bug c++/47132] [C++0x] " jason at gcc dot gnu.org
@ 2011-05-27 19:36 ` jason at gcc dot gnu.org
  2011-05-27 20:47 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 19:32:33 UTC ---
Author: jason
Date: Fri May 27 19:32:30 2011
New Revision: 174357

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174357
Log:
    PR c++/47132
    * mangle.c (write_expression): Handle MODOP_EXPR.

Added:
    trunk/gcc/testsuite/g++.dg/abi/mangle47.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/47132] [C++0x] decltype can't deduce some operator return types when defining an auto function's return
  2010-12-31  6:49 [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return yacwroy at gmail dot com
                   ` (2 preceding siblings ...)
  2011-05-27 19:36 ` jason at gcc dot gnu.org
@ 2011-05-27 20:47 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 20:45:24 UTC ---
Fixed for 4.7.


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

end of thread, other threads:[~2011-05-27 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-31  6:49 [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return yacwroy at gmail dot com
2010-12-31 14:40 ` [Bug c++/47132] " redi at gcc dot gnu.org
2011-05-27 17:46 ` [Bug c++/47132] [C++0x] " jason at gcc dot gnu.org
2011-05-27 19:36 ` jason at gcc dot gnu.org
2011-05-27 20:47 ` jason 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).