public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10619: Instantiation through function template return type causes too cryptic error.
@ 2003-05-04 13:46 gccbugs
  0 siblings, 0 replies; only message in thread
From: gccbugs @ 2003-05-04 13:46 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-04 13:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-04 13:46 c++/10619: Instantiation through function template return type causes too cryptic error gccbugs

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