Douglas Gregor | fcafc6e | 2011-05-24 16:02:01 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s |
| 2 | |
| 3 | // PR9999 |
| 4 | template<bool v> |
| 5 | class bitWidthHolding { |
| 6 | public: |
| 7 | static const |
| 8 | unsigned int width = (v == 0 ? 0 : bitWidthHolding<(v >> 1)>::width + 1); |
| 9 | }; |
| 10 | |
| 11 | static const int width=bitWidthHolding<255>::width; |
| 12 | |
| 13 | template<bool b> |
| 14 | struct always_false { |
| 15 | static const bool value = false; |
| 16 | }; |
| 17 | |
| 18 | template<bool b> |
| 19 | struct and_or { |
| 20 | static const bool and_value = b && and_or<always_false<b>::value>::and_value; |
| 21 | static const bool or_value = !b || and_or<always_false<b>::value>::or_value; |
| 22 | }; |
| 23 | |
| 24 | static const bool and_value = and_or<true>::and_value; |
| 25 | static const bool or_value = and_or<true>::or_value; |