diff options
author | Marek Polacek <polacek@redhat.com> | 2015-07-23 18:57:25 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-07-23 18:57:25 +0000 |
commit | 04e4dbd07cd613e086488a735d25e05ae939e117 (patch) | |
tree | c034e8d0c75394de7f51b9d77ca07b706cf8c3cd /gcc/testsuite | |
parent | 45952786d4d9f5aa4c2ce0aaa161b90b6f52c706 (diff) | |
download | gcc-04e4dbd07cd613e086488a735d25e05ae939e117.zip gcc-04e4dbd07cd613e086488a735d25e05ae939e117.tar.gz gcc-04e4dbd07cd613e086488a735d25e05ae939e117.tar.bz2 |
re PR c++/66572 (Bogus Wlogical-op warning for operands coming from template instantiations)
PR c++/66572
* pt.c (tsubst_copy_and_build): Add warn_logical_op sentinel.
* g++.dg/warn/Wlogical-op-2.C: New test.
From-SVN: r226120
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wlogical-op-2.C | 30 |
2 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c6d7e1..6bbc2e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-23 Marek Polacek <polacek@redhat.com> + + PR c++/66572 + * g++.dg/warn/Wlogical-op-2.C: New test. + 2015-07-23 Alexandre Oliva <aoliva@redhat.com> PR rtl-optimization/64164 diff --git a/gcc/testsuite/g++.dg/warn/Wlogical-op-2.C b/gcc/testsuite/g++.dg/warn/Wlogical-op-2.C new file mode 100644 index 0000000..755db08 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wlogical-op-2.C @@ -0,0 +1,30 @@ +// PR c++/66572 +// { dg-do compile { target c++11 } } +// { dg-options "-Wlogical-op" } + +struct false_type +{ + static constexpr bool value = false; +}; + +struct true_type +{ + static constexpr bool value = true; +}; + +template<typename T> +struct is_unsigned : false_type {}; + +template<> +struct is_unsigned<unsigned> : true_type {}; + +template<typename T1, typename T2> +bool foo() +{ + return is_unsigned<T1>::value && is_unsigned<T2>::value; +} + +int main() +{ + foo<unsigned, unsigned>(); +} |