public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: gccbugs@contacts.eelis.net
To: gcc-gnats@gcc.gnu.org
Subject: c++/10619: Instantiation through function template return type causes too cryptic error.
Date: Sun, 04 May 2003 13:46:00 -0000	[thread overview]
Message-ID: <20030504133904.29654.qmail@sources.redhat.com> (raw)


>Number:         10619
>Category:       c++
>Synopsis:       Instantiation through function template return type causes too cryptic error.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun May 04 13:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Eelis van der Weegen
>Release:        gcc version 3.2.2 (mingw special 20030208-1)
>Organization:
>Environment:
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c++,f77,objc --disable-win32-registry --disable-shared --enable-sjlj-exceptions
Thread model: win32
>Description:
When templates are instantiated through function template return types, errors during the instantiation are not always properly emitted. For example, given the following code:

  template <int I> struct A;
  template <int I> struct F { typename A<I>::type t; };
  template <int I> typename A<I>::type f ();

Instantiating F using:

  F<0> x;

causes a very clear error message:

  In instantiation of 'F<0>': instantiated from here [..] invalid use of undefined type 'struct A<0>'

However, performing the same instantiation through instantiating f() using:

  f<0>();

causes the following error:

  no matching function for call to 'f()'

This error seems to indicate an argument or CV-qualifier mismatch or something similar. It does not indicate that the problem occurs during the instantiation of the return type. Therefore, I think this error is too cryptic and, since cryptic errors lead to more time spent debugging, needs improvement. Something like:

  In instantiation of 'f<0>': instatiated from here [..] in instantiation of return type: invalid use of undefined 'struct A<0>'

would be ideal. What are your thoughts on this?
>How-To-Repeat:
Compile the code from the description.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2003-05-04 13:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030504133904.29654.qmail@sources.redhat.com \
    --to=gccbugs@contacts.eelis.net \
    --cc=gcc-gnats@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).