[Patch] PR c++/26256

Fabien Chêne fabien.chene@gmail.com
Wed Jun 15 19:42:00 GMT 2011


After updating the patch, I now see a failure on c++0x forward enums.
Consider the below code:

template <class T>
struct S1
    enum class E1;
    enum class E1;

Currently, the second declaration of E1 relies on a successfull call
to supplement_binding_1.
With the patch I am working on, it no longer succeeds, because a new
check is needed, in order to fail if (target_)bval is a type (nearly
similar to the fix for c++/48010).

if (TREE_CODE (target_decl) == TYPE_DECL && DECL_ARTIFICIAL (target_decl)
    && (TREE_CODE (target_bval) != TYPE_DECL

I don't really see a good solution to make it work.

As I already did for c++/48010, we can add the below check...
|| same_type_p (TREE_TYPE (target_decl), TREE_TYPE (target_bval)
But, same_type_p does not returns true, and it seems difficult to make
it return true because the underlying type of the DECL is not yet set
when calling pushtag1 in start_enum.

Otherwise, perhaps that it would be better if the second declaration
of E1 does not rely on supplement_binding_1.
What do you think ?


More information about the Gcc-patches mailing list