This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return
- From: "yacwroy at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 31 Dec 2010 06:49:24 +0000
- Subject: [Bug c++/47132] New: decltype can't deduce some operator return types when defining an auto function's return
- Auto-submitted: auto-generated
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.