public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paulotorrens at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53586] Internal compiler errors on cp/pt.c:12077 and expr.c:9147
Date: Wed, 06 Jun 2012 18:43:00 -0000 [thread overview]
Message-ID: <bug-53586-4-HiQ52Lo34y@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53586-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53586
--- Comment #2 from Paulo Torrens <paulotorrens at gnu dot org> 2012-06-06 18:43:13 UTC ---
(In reply to comment #1)
> What happens if you use decltype instead of typeof ?
template<typename T> auto ptr2bitmap(T *bitmap, int width, int depth = 3) ->
decltype(decltype(unsigned char[depth])[width]) *{
return bitmap;
};
int main() {
void *x;
auto a = ptr2bitmap(x, 100);
};
test.cpp:2:10: error: expected primary-expression before 'decltype'
test.cpp:2:10: error: expected ')' before 'decltype'
test.cpp:2:1: error: expected type-specifier before 'decltype'
test.cpp:2:1: error: expected initializer before 'decltype'
And without decltype and typeof at all:
template<typename T> auto ptr2bitmap(T *bitmap, int width, int depth = 3) ->
unsigned char[depth][width] *{
return bitmap;
};
int main() {
void *x;
auto a = ptr2bitmap(x, 100);
};
test.cpp:2:15: error: use of parameter 'depth' outside function body
test.cpp:2:22: error: use of parameter 'width' outside function body
test.cpp:2:29: error: expected initializer before '*' token
next prev parent reply other threads:[~2012-06-06 18:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 5:07 [Bug c++/53586] New: " paulotorrens at gnu dot org
2012-06-06 5:58 ` [Bug c++/53586] " pinskia at gcc dot gnu.org
2012-06-06 18:43 ` paulotorrens at gnu dot org [this message]
2013-08-09 19:29 ` paolo.carlini at oracle dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-53586-4-HiQ52Lo34y@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).