This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/18969 (invalid return statement diagnosed too late)
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Jason Merrill <jason at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- Date: Sun, 26 Jul 2015 13:50:18 -0400
- Subject: Re: [PATCH] Fix PR c++/18969 (invalid return statement diagnosed too late)
- Authentication-results: sourceware.org; auth=none
- References: <1437878959-10982-1-git-send-email-patrick at parcs dot ath dot cx> <55B4581F dot 1080900 at redhat dot com> <CA+C-WL-dxy4jO+8w1ZLE5iSampTi+oMecUpkSuuubw22=x-vBQ at mail dot gmail dot com>
On Sun, Jul 26, 2015 at 1:09 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> Committed with this additional change to fix a latent testcase bug:
>
> diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload.C
> b/gcc/testsuite/g++.old-deja/g++.jason/overload.C
> index 6a747ff..28b029f 100644
> --- a/gcc/testsuite/g++.old-deja/g++.jason/overload.C
> +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload.C
> @@ -5,7 +5,7 @@ enum bar {};
> void operator+ (int, int);// { dg-error "" } .*
> void operator+ (bar&, int);
>
> -template <class T> void operator+ (int b, T& t) { return b; }
> +template <class T> void operator+ (int b, T& t) { return; }
> void operator+ (int, bar&);
>
> template <class T> class foo
Hmm, on second thought, I don't think this fix is right. It may be
the case that the 'return b;' was there to make instantiation of that
template a compile-time error. By changing it to 'return;'
instantiation is allowed. Is this property important here? Should I
preserve the original property (that instantiation is a compile-time
error) by instead doing the following?
Adjust g++.old-deja/g++.jason/overload.C
gcc/testsuite/ChangeLog:
* g++.old-deja/g++.jason/overload.C: Adjust to preserve original
property that instantiation is a compile-time error.
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload.C
b/gcc/testsuite/g++.old-deja/g++.jason/overload.C
index 28b029f..5d27713 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/overload.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/overload.C
@@ -5,7 +5,7 @@ enum bar {};
void operator+ (int, int);// { dg-error "" } .*
void operator+ (bar&, int);
-template <class T> void operator+ (int b, T& t) { return; }
+template <class T> void operator+ (int b, T& t) { (void) T::bogus; }
void operator+ (int, bar&);
template <class T> class foo