From 8de7190350263d381df5c12cfbbfb4191b8d3973 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 13 Oct 2017 16:50:13 +0000 Subject: [PATCH] re PR c++/80873 (ICE in tsubst_copy when trying to use an overloaded function without a definition in a lambda) 2017-10-13 Paolo Carlini PR c++/80873 * g++.dg/cpp1y/auto-fn41.C: New. * g++.dg/cpp1y/auto-fn42.C: Likewise. From-SVN: r253733 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp1y/auto-fn41.C | 23 +++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp1y/auto-fn42.C | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/auto-fn41.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/auto-fn42.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6bb877ea387..f3dbf5d9286 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-10-13 Paolo Carlini + + PR c++/80873 + * g++.dg/cpp1y/auto-fn41.C: New. + * g++.dg/cpp1y/auto-fn42.C: Likewise. + 2017-10-13 David Malcolm * g++.dg/cpp0x/udlit-extern-c.C: New test case. diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn41.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn41.C new file mode 100644 index 00000000000..25a879da118 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn41.C @@ -0,0 +1,23 @@ +// PR c++/80873 +// { dg-do compile { target c++14 } } + +struct S {}; + +auto overloaded(S &); + +template +int overloaded(T &) { + return 0; +} + +template +auto returns_lambda(T ¶m) { + return [&] { + overloaded(param); // { dg-error "before deduction" } + }; +} + +int main() { + S s; + returns_lambda(s); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn42.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn42.C new file mode 100644 index 00000000000..0f2b68efa42 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn42.C @@ -0,0 +1,21 @@ +// PR c++/80873 +// { dg-do compile { target c++14 } } + +struct Buffer {}; + +auto parse(Buffer b); +template void parse(T target); + +template +auto field(T target) { + return [&] { + parse(target); + }; +} + +template +void parse(T target) {} + +auto parse(Buffer b) { + field(0); +} -- 2.30.2