This is the mail archive of the gcc-patches@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]

Re: Many C++ PATCHes for SFINAE fixes


n Thu, Apr 7, 2011 at 2:32 PM, Jason Merrill <jason@redhat.com> wrote:
> People have been finding other places where we haven't been handling SFINAE
> properly. ?In many cases, there are two patches for each fix; the first one
> fixes the bug conservatively (for possible application to 4.6), and the
> second one reorganizes things to be cleaner.
>
> Tested x86_64-pc-linux-gnu, applying to trunk.
>



>
> commit 9690fccd312c95916260a0ba5f07e397af811b37
> Author: Jason Merrill <jason@redhat.com>
> Date: ? Tue Apr 5 22:02:35 2011 -0400
>
> ? ? ? ?PR c++/48452
> ? ? ? ?* typeck.c (build_x_compound_expr_from_list): Return error_mark_node
> ? ? ? ?in SFINAE context.
>
> diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
> index 8e3796e..ecd7d41 100644
> --- a/gcc/cp/typeck.c
> +++ b/gcc/cp/typeck.c
> @@ -5472,6 +5472,8 @@ build_x_compound_expr_from_list (tree list,
> expr_list_kind exp,
> ? ? ? ? ?default:
> ? ? ? ? ? ?gcc_unreachable ();
> ? ? ? ? ?}
> + ? ? ?else
> + ? ? ? return error_mark_node;
>
> ? ? ? for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list))
> ? ? ? ?expr = build_x_compound_expr (expr, TREE_VALUE (list),
> diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae10.C
> b/gcc/testsuite/g++.dg/cpp0x/sfinae10.C
> new file mode 100644
> index 0000000..ede8b70
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae10.C
> @@ -0,0 +1,18 @@
> +// PR c++/48452
> +// { dg-options -std=c++0x }
> +namespace std {
> + ?template <class T> T&& declval();
> +}
> +
> +template<class T, class... Args>
> +decltype(T(std::declval<Args>()...), char()) f(int);
> +
> +template<class, class...>
> +char (&f(...))[2];
> +
> +struct A { virtual ~A() = 0; };
> +struct B {};
> +
> +static_assert(sizeof(f<A, int, int>(0)) != 1, "Error"); // a
> +static_assert(sizeof(f<B, void, int>(0)) != 1, "Error"); // b
> +static_assert(sizeof(f<void, int, int>(0)) != 1, "Error"); // c
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48528

-- 
H.J.


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