summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2011-08-12 20:56:43 +0000
committerJeffrey Yasskin <jyasskin@google.com>2011-08-12 20:56:43 +0000
commit94f8c779314c50601c5dc66ded879515798b8bf1 (patch)
tree036d451c07ddc86f0c664a94edbbe0a50a36f020 /clang/test
parenta52aa3c18fa65ed65abbd0ea0f91684da2eae210 (diff)
downloadbcm5719-llvm-94f8c779314c50601c5dc66ded879515798b8bf1.tar.gz
bcm5719-llvm-94f8c779314c50601c5dc66ded879515798b8bf1.zip
Conversions to bool count as integer conversions for the purposes of
the C++0x narrowing error. llvm-svn: 137512
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
index f82e6cac206..c7f61fbd188 100644
--- a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
+++ b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
@@ -138,6 +138,12 @@ void shrink_int() {
Agg<int> i2 = {0x7FFFFFFFU}; // OK
Agg<int> i3 = {0x80000000U}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
Agg<unsigned int> i4 = {-0x80000000L}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+
+ // Bool is also an integer type, but conversions to it are a different AST
+ // node.
+ Agg<bool> b1 = {0}; // OK
+ Agg<bool> b2 = {1}; // OK
+ Agg<bool> b3 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
}
// Be sure that type- and value-dependent expressions in templates get the error
OpenPOWER on IntegriCloud