This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66586] New: Template backtrace is truncated/absent after 'template argument deduction/substitution failed:'


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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]