Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Morgner2017-07-24 15:29:38 -0400
committerNathan Ridge2019-02-22 03:29:05 -0500
commit2272a74f38283afd3a6777dae3d41e501c4c4c54 (patch)
tree0411fe9847c9c99f54c45157cd5a86a5e1ac7c7c /core/org.eclipse.cdt.core.tests
parent0757b45da5db47a65f59911c42eb9dcccfbdf972 (diff)
downloadorg.eclipse.cdt-2272a74f38283afd3a6777dae3d41e501c4c4c54.tar.gz
org.eclipse.cdt-2272a74f38283afd3a6777dae3d41e501c4c4c54.tar.xz
org.eclipse.cdt-2272a74f38283afd3a6777dae3d41e501c4c4c54.zip
Bug 520117: [C++14] Return type deduction deduces wrong type for
parenthesized expressions in return This patchset fixes 520117 and adjusts the value category of expressions of kind E1.E2 to be standard (DR616) compliant. Change-Id: I9a5cde805f2d0b39a2d263dbc3dcbefd3ba21930 Signed-off-by: Felix Morgner <fmorgner@hsr.ch>
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java
index bcb161f0354..6c86c338777 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java
@@ -313,4 +313,21 @@ public class ReturnTypeDeductionTests extends AST2CPPTestBase {
BindingAssertionHelper helper = getAssertionHelper();
helper.assertVariableType("waldo", CommonCPPTypes.int_);
}
+
+ // struct A {
+ // decltype(auto) f() { return (var); }
+ // int var{};
+ // };
+ public void testParenthesizedIdIsLValueReference_520117() throws Exception {
+ assertReturnType("f", CommonCPPTypes.referenceToInt);
+ }
+
+ // struct s{ int v{}; };
+ //
+ // decltype(auto) f() {
+ // return (s{}.v);
+ // }
+ public void testParenthesizedXValueIsRValueReference_520117() throws Exception {
+ assertReturnType("f", CommonCPPTypes.rvalueReferenceToInt);
+ }
} \ No newline at end of file

Back to the top