diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-19 20:47:20 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-19 20:47:20 +0000 |
commit | c5c27f2a1f2610ea32c249f3def799ca97a65f6e (patch) | |
tree | 46fd170437b34eabf0479ee3f536cbc38375d498 /clang/test/Lexer | |
parent | 7f2ab897743a9d0fafeb7bb2d28d732ac46275bf (diff) | |
download | bcm5719-llvm-c5c27f2a1f2610ea32c249f3def799ca97a65f6e.tar.gz bcm5719-llvm-c5c27f2a1f2610ea32c249f3def799ca97a65f6e.zip |
Note that we support (and in fact have supported since the dawn of time itself)
C++1y binary literals.
llvm-svn: 179883
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r-- | clang/test/Lexer/cxx1y_binary_literal.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/Lexer/cxx1y_binary_literal.cpp b/clang/test/Lexer/cxx1y_binary_literal.cpp new file mode 100644 index 00000000000..96dce3dd443 --- /dev/null +++ b/clang/test/Lexer/cxx1y_binary_literal.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -std=c++1y %s -verify + +static_assert(0b1001 == 9, ""); + +using I = int; +using I = decltype(0b101001); +using ULL = unsigned long long; +using ULL = decltype(0b10101001ULL); + +constexpr unsigned long long operator""_foo(unsigned long long n) { + return n * 2; +} +static_assert(0b10001111_foo == 286, ""); + +int k1 = 0b1234; // expected-error {{invalid digit '2' in binary constant}} +// FIXME: If we ever need to support a standard suffix starting with [a-f], +// we'll need to rework our binary literal parsing rules. +int k2 = 0b10010f; // expected-error {{invalid digit 'f' in binary constant}} +int k3 = 0b10010g; // expected-error {{invalid suffix 'g' on integer constant}} |