aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/conditional-expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-13 08:18:22 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-13 08:18:22 +0000
commit5291c3cec0dbe8ad1d8e7e67e93af2b1586d5400 (patch)
treec9cebfe28bcfbcf6a820b87156614132f6e84176 /test/SemaCXX/conditional-expr.cpp
parentaef01998af5bbfc1cdfac091248ff7d30ec31456 (diff)
When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/conditional-expr.cpp')
-rw-r--r--test/SemaCXX/conditional-expr.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index d008b8d6ed..9cbc324467 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -282,3 +282,20 @@ namespace rdar7998817 {
: X());
}
}
+
+namespace PR7598 {
+ enum Enum {
+ v = 1,
+ };
+
+ const Enum g() { // expected-warning{{type qualifier on return type has no effect}}
+ return v;
+ }
+
+ void f() {
+ const Enum v2 = v;
+ Enum e = false ? g() : v;
+ Enum e2 = false ? v2 : v;
+ }
+
+}