Skip to content

Commit f3de421

Browse files
committed
Require named (not deduced) type for a temporary unnamed object
1 parent a9ae3a1 commit f3de421

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/parse.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,11 @@ class parser
15971597
{
15981598
assert (!decl->identifier && "ICE: declaration should have been unnamed");
15991599
if (auto obj = std::get_if<declaration_node::object>(&decl->type)) {
1600-
//if ((*obj)->typid)
1600+
if ((*obj)->is_wildcard()) {
1601+
error("an unnamed object at expression scope currently cannot have a deduced type (the reason to create an unnamed object is typically to create a temporary of a named type)");
1602+
next();
1603+
return {};
1604+
}
16011605
}
16021606
else if (auto func = std::get_if<declaration_node::function>(&decl->type)) {
16031607
if ((*func)->returns.index() == function_type_node::list) {

0 commit comments

Comments
 (0)