Compare commits
No commits in common. "main" and "1.3.0-3" have entirely different histories.
@ -86,8 +86,6 @@ class PlyLexer:
|
||||
"concept",
|
||||
"const",
|
||||
"constexpr",
|
||||
"consteval",
|
||||
"constinit",
|
||||
"const_cast",
|
||||
"continue",
|
||||
"decltype",
|
||||
|
@ -2148,8 +2148,6 @@ class CxxParser:
|
||||
|
||||
if fn.constexpr:
|
||||
raise CxxParseError("typedef function may not be constexpr")
|
||||
if fn.consteval:
|
||||
raise CxxParseError("typedef function may not be consteval")
|
||||
if fn.extern:
|
||||
raise CxxParseError("typedef function may not be extern")
|
||||
if fn.static:
|
||||
@ -2320,7 +2318,7 @@ class CxxParser:
|
||||
return dtype
|
||||
|
||||
# Applies to variables and return values
|
||||
_type_kwd_both = {"const", "consteval", "constexpr", "constinit", "extern", "inline", "static"}
|
||||
_type_kwd_both = {"const", "constexpr", "extern", "inline", "static"}
|
||||
|
||||
# Only found on methods
|
||||
_type_kwd_meth = {"explicit", "virtual"}
|
||||
|
@ -721,7 +721,6 @@ class Function:
|
||||
doxygen: typing.Optional[str] = None
|
||||
|
||||
constexpr: bool = False
|
||||
consteval: bool = False
|
||||
extern: typing.Union[bool, str] = False
|
||||
static: bool = False
|
||||
inline: bool = False
|
||||
@ -858,7 +857,6 @@ class Variable:
|
||||
value: typing.Optional[Value] = None
|
||||
|
||||
constexpr: bool = False
|
||||
constinit: bool = False
|
||||
extern: typing.Union[bool, str] = False
|
||||
static: bool = False
|
||||
inline: bool = False
|
||||
@ -885,7 +883,6 @@ class Field:
|
||||
bits: typing.Optional[int] = None
|
||||
|
||||
constexpr: bool = False
|
||||
constinit: bool = False
|
||||
mutable: bool = False
|
||||
static: bool = False
|
||||
inline: bool = False
|
||||
|
@ -1,104 +0,0 @@
|
||||
def test_constinit_consteval() -> None:
|
||||
content = """
|
||||
struct S
|
||||
{
|
||||
static constinit int i = 5;
|
||||
|
||||
static consteval int func(int i) { return i*i; }
|
||||
};
|
||||
|
||||
template<std::size_t numBits>
|
||||
consteval auto getUintType()
|
||||
{
|
||||
if constexpr (numBits == 8) {
|
||||
return std::uint8_t{};
|
||||
}
|
||||
else if constexpr (numBits == 16) {
|
||||
return std::uint16_t{};
|
||||
}
|
||||
else if constexpr (numBits == 32) {
|
||||
return std::uint32_t{};
|
||||
}
|
||||
else if constexpr (numBits == 64) {
|
||||
return std::uint64_t{};
|
||||
}
|
||||
}
|
||||
"""
|
||||
data = parse_string(content, cleandoc=True)
|
||||
|
||||
assert data == ParsedData(
|
||||
namespace=NamespaceScope(
|
||||
classes=[
|
||||
ClassScope(
|
||||
class_decl=ClassDecl(
|
||||
typename=PQName(
|
||||
segments=[NameSpecifier(name="S")], classkey="struct"
|
||||
)
|
||||
),
|
||||
fields=[
|
||||
Field(
|
||||
access="public",
|
||||
type=Type(
|
||||
typename=PQName(
|
||||
segments=[FundamentalSpecifier(name="int")]
|
||||
)
|
||||
),
|
||||
name="i",
|
||||
value=Value(tokens=[Token(value="5")]),
|
||||
constinit=True,
|
||||
static=True,
|
||||
)
|
||||
],
|
||||
methods=[
|
||||
Method(
|
||||
return_type=Type(
|
||||
typename=PQName(
|
||||
segments=[FundamentalSpecifier(name="int")]
|
||||
)
|
||||
),
|
||||
name=PQName(segments=[NameSpecifier(name="func")]),
|
||||
parameters=[
|
||||
Parameter(
|
||||
type=Type(
|
||||
typename=PQName(
|
||||
segments=[FundamentalSpecifier(name="int")]
|
||||
)
|
||||
),
|
||||
name="i",
|
||||
)
|
||||
],
|
||||
consteval=True,
|
||||
static=True,
|
||||
has_body=True,
|
||||
access="public",
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
functions=[
|
||||
Function(
|
||||
return_type=Type(typename=PQName(segments=[AutoSpecifier()])),
|
||||
name=PQName(segments=[NameSpecifier(name="getUintType")]),
|
||||
parameters=[],
|
||||
consteval=True,
|
||||
has_body=True,
|
||||
template=TemplateDecl(
|
||||
params=[
|
||||
TemplateNonTypeParam(
|
||||
type=Type(
|
||||
typename=PQName(
|
||||
segments=[
|
||||
NameSpecifier(name="std"),
|
||||
NameSpecifier(name="size_t"),
|
||||
]
|
||||
)
|
||||
),
|
||||
name="numBits",
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user