diff options
author | Dodji Seketeli <dodji@redhat.com> | 2010-04-20 19:23:45 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2010-04-20 21:23:45 +0200 |
commit | 5a80a1ddff8f6a6c5b7395a258361f8d46106657 (patch) | |
tree | 62f4ffad70d86ffc0bbafdc9ecb49f5d873e0a6d /gcc/cp/typeck.c | |
parent | 9c4174d8533b2aa1386eb24a8a0debc642773e11 (diff) | |
download | gcc-5a80a1ddff8f6a6c5b7395a258361f8d46106657.zip gcc-5a80a1ddff8f6a6c5b7395a258361f8d46106657.tar.gz gcc-5a80a1ddff8f6a6c5b7395a258361f8d46106657.tar.bz2 |
re PR c++/43800 (FAIL: libgomp.c++/for-4.C)
Fix PR c++/43800
gcc/cp/ChangeLog:
PR c++/43800
PR c++/43704
* typeck.c (incompatible_dependent_types_p): If one of the
compared types if not a typedef then honour their main variant
equivalence.
gcc/testsuite/ChangeLog:
PR c++/43800
PR c++/43704
* g++.dg/template/typedef32.C: Adjust.
* g++.dg/template/typedef33.C: New test.
From-SVN: r158571
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r-- | gcc/cp/typeck.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index c43cf33..bc699a1 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1155,6 +1155,7 @@ static bool incompatible_dependent_types_p (tree t1, tree t2) { tree tparms1 = NULL_TREE, tparms2 = NULL_TREE; + bool t1_typedef_variant_p, t2_typedef_variant_p; if (!uses_template_parms (t1) || !uses_template_parms (t2)) return false; @@ -1167,10 +1168,22 @@ incompatible_dependent_types_p (tree t1, tree t2) return true; } + t1_typedef_variant_p = typedef_variant_p (t1); + t2_typedef_variant_p = typedef_variant_p (t2); + /* Either T1 or T2 must be a typedef. */ - if (!typedef_variant_p (t1) && !typedef_variant_p (t2)) + if (!t1_typedef_variant_p && !t2_typedef_variant_p) return false; + if (!t1_typedef_variant_p || !t2_typedef_variant_p) + /* Either T1 or T2 is not a typedef so we cannot compare the + the template parms of the typedefs of T1 and T2. + At this point, if the main variant type of T1 and T2 are equal + it means the two types can't be incompatible, from the perspective + of this function. */ + if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) + return false; + /* So if we reach this point, it means either T1 or T2 is a typedef variant. Let's compare their template parameters. */ |