public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66586] New: Template backtrace is truncated/absent after 'template argument deduction/substitution failed:'
@ 2015-06-18 12:52 lucdanton at free dot fr
  2015-06-18 12:59 ` [Bug c++/66586] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lucdanton at free dot fr @ 2015-06-18 12:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66586

            Bug ID: 66586
           Summary: Template backtrace is truncated/absent after 'template
                    argument deduction/substitution failed:'
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr
  Target Milestone: ---

Created attachment 35801
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35801&action=edit
Minimal testcase

I've noticed that sometimes GCC presents e.g.

> main.cpp:8:25: note:   template argument deduction/substitution failed:

but then entirely omits the template instantiation backtrace. I've had a hard
time reproducing it so far but I finally found an example. Also happens with
4.9.2. Unrolling the result template alias by hand into the return type of foo
produces the expected behaviour, with a backtrace pointing to the mistake.

$ g++-trunk --version
g++-trunk (GCC) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat main.cpp
template<typename>
struct trivial { using type = int; };

template<typename... Xs>
using result = typename trivial<Xs...>::type;

template<typename... Xs>
constexpr result<Xs...> foo(Xs...)
{ return 0; }

int main()
{
    foo(0, 0);
}
$ g++-trunk -std=c++11 main.cpp
main.cpp: In function 'int main()':
main.cpp:13:13: error: no matching function for call to 'foo(int, int)'
     foo(0, 0);
             ^
main.cpp:8:25: note: candidate: template<class ... Xs> constexpr result<Xs ...>
foo(Xs ...)
 constexpr result<Xs...> foo(Xs...)
                         ^
main.cpp:8:25: note:   template argument deduction/substitution failed:
$ #prompt resumes here!


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

end of thread, other threads:[~2024-04-06 23:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 12:52 [Bug c++/66586] New: Template backtrace is truncated/absent after 'template argument deduction/substitution failed:' lucdanton at free dot fr
2015-06-18 12:59 ` [Bug c++/66586] " redi at gcc dot gnu.org
2015-08-04 15:11 ` paolo.carlini at oracle dot com
2024-04-06 23:16 ` pinskia at gcc dot gnu.org
2024-04-06 23:16 ` pinskia 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).