You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"the name 'operator' is incomplete - did you mean to write an overloaded operator name like 'operator*' or 'operator++'?"
1521
1525
);
@@ -1529,7 +1533,7 @@ class sema
1529
1533
&& !n.has_initializer()
1530
1534
)
1531
1535
{
1532
-
errors.emplace_back(
1536
+
handle_error(
1533
1537
n.position(),
1534
1538
"an object with a deduced type must have an = initializer"
1535
1539
);
@@ -1543,7 +1547,7 @@ class sema
1543
1547
&& !n.initializer->is_expression()
1544
1548
)
1545
1549
{
1546
-
errors.emplace_back(
1550
+
handle_error(
1547
1551
n.position(),
1548
1552
"an object initializer must be an expression"
1549
1553
);
@@ -1559,7 +1563,7 @@ class sema
1559
1563
)
1560
1564
)
1561
1565
{
1562
-
errors.emplace_back(
1566
+
handle_error(
1563
1567
n.position(),
1564
1568
"a namespace must be = initialized with a { } body containing declarations"
1565
1569
);
@@ -1573,7 +1577,7 @@ class sema
1573
1577
&& n.initializer->is_return()
1574
1578
)
1575
1579
{
1576
-
errors.emplace_back(
1580
+
handle_error(
1577
1581
n.position(),
1578
1582
"a function with a single-expression body doesn't need to say 'return' - either omit 'return' or write a full { }-enclosed function body"
1579
1583
);
@@ -1588,7 +1592,7 @@ class sema
1588
1592
&& !n.has_initializer()
1589
1593
)
1590
1594
{
1591
-
errors.emplace_back(
1595
+
handle_error(
1592
1596
n.position(),
1593
1597
"a function must have a body ('=' initializer), unless it is virtual (has a 'virtual this' parameter) or is defaultable (operator== or operator<=>)"
1594
1598
);
@@ -1601,7 +1605,7 @@ class sema
1601
1605
&& !n.parent_is_type()
1602
1606
)
1603
1607
{
1604
-
errors.emplace_back(
1608
+
handle_error(
1605
1609
n.position(),
1606
1610
"(temporary alpha limitation) a type must be in a namespace or type scope - function-local types are not yet supported"
1607
1611
);
@@ -1614,7 +1618,7 @@ class sema
1614
1618
&& n.has_wildcard_type()
1615
1619
)
1616
1620
{
1617
-
errors.emplace_back(
1621
+
handle_error(
1618
1622
n.position(),
1619
1623
"a type scope variable must have a declared type"
1620
1624
);
@@ -1632,7 +1636,7 @@ class sema
1632
1636
)
1633
1637
)
1634
1638
{
1635
-
errors.emplace_back(
1639
+
handle_error(
1636
1640
n.identifier->position(),
1637
1641
"'this' may only be declared as an ordinary function parameter or type-scope (base) object"
1638
1642
);
@@ -1646,14 +1650,14 @@ class sema
1646
1650
1647
1651
if (this_index >= 0) {
1648
1652
if (!n.parent_is_type()) {
1649
-
errors.emplace_back(
1653
+
handle_error(
1650
1654
n.position(),
1651
1655
"'this' must be the first parameter of a type-scope function"
1652
1656
);
1653
1657
returnfalse;
1654
1658
}
1655
1659
if (this_index != 0) {
1656
-
errors.emplace_back(
1660
+
handle_error(
1657
1661
n.position(),
1658
1662
"'this' must be the first parameter"
1659
1663
);
@@ -1663,14 +1667,14 @@ class sema
1663
1667
1664
1668
if (that_index >= 0) {
1665
1669
if (!n.parent_is_type()) {
1666
-
errors.emplace_back(
1670
+
handle_error(
1667
1671
n.position(),
1668
1672
"'that' must be the second parameter of a type-scope function"
1669
1673
);
1670
1674
returnfalse;
1671
1675
}
1672
1676
if (that_index != 1) {
1673
-
errors.emplace_back(
1677
+
handle_error(
1674
1678
n.position(),
1675
1679
"'that' must be the second parameter"
1676
1680
);
@@ -1685,7 +1689,7 @@ class sema
1685
1689
&& n.parent_is_namespace()
1686
1690
)
1687
1691
{
1688
-
errors.emplace_back(
1692
+
handle_error(
1689
1693
n.identifier->position(),
1690
1694
"namespace scope objects must have a concrete type, not a deduced type"
1691
1695
);
@@ -1699,7 +1703,7 @@ class sema
1699
1703
&& !n.is_object_alias()
1700
1704
)
1701
1705
{
1702
-
errors.emplace_back(
1706
+
handle_error(
1703
1707
n.identifier->position(),
1704
1708
"'_' (wildcard) may not be the name of a function or type - it may only be used as the name of an anonymous object, object alias, or namespace"
1705
1709
);
@@ -1712,7 +1716,7 @@ class sema
1712
1716
)
1713
1717
{
1714
1718
if (!n.is_object()) {
1715
-
errors.emplace_back(
1719
+
handle_error(
1716
1720
n.position(),
1717
1721
"a member named 'this' declares a base subobject, and must be followed by a base type name"
1718
1722
);
@@ -1724,7 +1728,7 @@ class sema
1724
1728
&& !n.is_default_access()
1725
1729
)
1726
1730
{
1727
-
errors.emplace_back(
1731
+
handle_error(
1728
1732
n.position(),
1729
1733
"a base type must be public (the default)"
1730
1734
);
@@ -1733,7 +1737,7 @@ class sema
1733
1737
1734
1738
if (n.has_wildcard_type())
1735
1739
{
1736
-
errors.emplace_back(
1740
+
handle_error(
1737
1741
n.position(),
1738
1742
"a base type must be a specific type, not a deduced type (omitted or '_'-wildcarded)"
1739
1743
);
@@ -1746,7 +1750,7 @@ class sema
1746
1750
&& !n.parent_is_type()
1747
1751
)
1748
1752
{
1749
-
errors.emplace_back(
1753
+
handle_error(
1750
1754
n.position(),
1751
1755
"an access-specifier is only allowed on a type-scope (member) declaration"
1752
1756
);
@@ -1761,7 +1765,7 @@ class sema
1761
1765
&& (*func->parameters)[0]->has_name("this")
1762
1766
);
1763
1767
if ((*func->parameters)[0]->is_polymorphic()) {
1764
-
errors.emplace_back(
1768
+
handle_error(
1765
1769
n.position(),
1766
1770
"a constructor may not be declared virtual, override, or final"
1767
1771
);
@@ -1777,7 +1781,7 @@ class sema
1777
1781
{
1778
1782
assert (n.identifier->get_token());
1779
1783
auto name = n.identifier->get_token()->to_string();
1780
-
errors.emplace_back(
1784
+
handle_error(
1781
1785
n.position(),
1782
1786
"(temporary alpha limitation) local functions like '" + name + ": (/*params*/) = {/*body*/}' are not currently supported - write a local variable initialized with an unnamed function like '" + name + " := :(/*params*/) = {/*body*/};' instead (add '=' and ';')"
1783
1787
);
@@ -1796,7 +1800,7 @@ class sema
1796
1800
)
1797
1801
)
1798
1802
{
1799
-
errors.emplace_back(
1803
+
handle_error(
1800
1804
n.position(),
1801
1805
"overloading '" + n.name()->to_string() + "' is not allowed"
1802
1806
);
@@ -1824,7 +1828,7 @@ class sema
1824
1828
)
1825
1829
)
1826
1830
{
1827
-
errors.emplace_back(
1831
+
handle_error(
1828
1832
n.position(),
1829
1833
n.name()->to_string() + " must have 'this' as the first parameter"
1830
1834
);
@@ -1861,7 +1865,7 @@ class sema
1861
1865
// ... and if it isn't that, then complain
1862
1866
else
1863
1867
{
1864
-
errors.emplace_back(
1868
+
handle_error(
1865
1869
params[0]->position(),
1866
1870
"'main' must be declared as 'main: ()' with zero parameters, or 'main: (args)' with one parameter named 'args' for which the type 'std::vector<std::string_view>' will be deduced"
0 commit comments