summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorLarisse Voufo <lvoufo@google.com>2013-06-18 01:27:47 +0000
committerLarisse Voufo <lvoufo@google.com>2013-06-18 01:27:47 +0000
commit9f380c55cef00cf5446691fca7720d0ada17c18a (patch)
tree7dc57d2d218495c2f99c5b5fe8b7dfc9a5227d59 /clang
parent37fae74a88ad335ce1107d9fa3bb3bb3a5c720f6 (diff)
downloadbcm5719-llvm-9f380c55cef00cf5446691fca7720d0ada17c18a.tar.gz
bcm5719-llvm-9f380c55cef00cf5446691fca7720d0ada17c18a.zip
r184100 Fix -- Updated test cases for contextual conversion
llvm-svn: 184165
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp6
-rw-r--r--clang/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp22
-rw-r--r--clang/test/SemaCXX/cxx98-compat-pedantic.cpp2
3 files changed, 25 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 40af2075c3f..d723c1fe77d 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1205,9 +1205,9 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
AA_Converting);
if (!isSFINAEContext())
- // Diagnose the compatibility of this conversion.
- Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
- << ArraySize->getType() << 0 << Context.getSizeType();
+ // Diagnose the compatibility of this conversion.
+ Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
+ << ArraySize->getType() << 0 << "'size_t'";
} else {
class SizeConvertDiagnoser : public ICEConvertDiagnoser {
protected:
diff --git a/clang/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp b/clang/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp
index f00bf1ea310..58bbbb2a044 100644
--- a/clang/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp
+++ b/clang/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp
@@ -154,4 +154,24 @@ namespace extended_examples_cxx1y {
//expected-error@143 {{cannot initialize object parameter of type 'extended_examples_cxx1y::D' with an expression of type 'extended_examples_cxx1y::D'}}
#endif
-// FIXME: Extend with more examples, including [expr.const] and [expr.new].
+namespace extended_examples_array_bounds {
+
+ typedef decltype(sizeof(int)) size_t;
+
+ struct Foo {
+ operator size_t(); // @162
+ operator unsigned short(); // @163
+ };
+
+ void bar() {
+ Foo x;
+ int *p = new int[x]; // @168
+ }
+}
+
+#ifdef CXX1Y
+#else
+//expected-error@168 {{ambiguous conversion of array size expression of type 'extended_examples_array_bounds::Foo' to an integral or enumeration type}}
+//expected-note@162 {{conversion to integral type 'size_t'}}
+//expected-note@163 {{conversion to integral type 'unsigned short' declared here}}
+#endif
diff --git a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp
index 5fe7980994e..50ce6a49002 100644
--- a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp
+++ b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp
@@ -34,7 +34,7 @@ struct ConvertToInt {
};
int *ArraySizeConversion = new int[ConvertToInt()];
#ifdef CXX1Y2
-// expected-warning@-2 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type}} // 'unsigned long' is incompatible with C++98}}
+// expected-warning@-2 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'size_t' is incompatible with C++98}}
#else
// expected-warning@-4 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'int' is incompatible with C++98}}
#endif
OpenPOWER on IntegriCloud