Add dedicated error message for pointer to reference
diff --git a/syntax/check.rs b/syntax/check.rs
index c76ef19..eba6565 100644
--- a/syntax/check.rs
+++ b/syntax/check.rs
@@ -235,7 +235,11 @@
fn check_type_ptr(cx: &mut Check, ty: &Ptr) {
match ty.inner {
- Type::Ref(_) | Type::Ptr(_) | Type::Fn(_) | Type::Void(_) => {}
+ Type::Ptr(_) | Type::Fn(_) | Type::Void(_) => {}
+ Type::Ref(_) => {
+ cx.error(ty, "C++ does not allow pointer to reference as a type");
+ return;
+ }
_ => return,
}
diff --git a/tests/ui/ptr_unsupported.stderr b/tests/ui/ptr_unsupported.stderr
index b5e8a78..e037faa 100644
--- a/tests/ui/ptr_unsupported.stderr
+++ b/tests/ui/ptr_unsupported.stderr
@@ -4,7 +4,7 @@
6 | fn get_ptr_to_ptr() -> *mut *mut C;
| ^^^^^^^^^^^
-error: unsupported pointer type
+error: C++ does not allow pointer to reference as a type
--> $DIR/ptr_unsupported.rs:7:38
|
7 | fn get_ptr_to_reference() -> *mut &C;