Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
6b9ac4dd
Commit
6b9ac4dd
authored
Aug 14, 2015
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #233
parent
e50f9571
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+4
-1
test.capnp
c++/src/capnp/test.capnp
+9
-0
No files found.
c++/src/capnp/compiler/capnpc-c++.c++
View file @
6b9ac4dd
...
@@ -1056,7 +1056,10 @@ private:
...
@@ -1056,7 +1056,10 @@ private:
kj
::
str
(
kj
::
str
(
" if (which() != "
,
scope
,
upperCase
,
") return false;
\n
"
),
" if (which() != "
,
scope
,
upperCase
,
") return false;
\n
"
),
kj
::
str
(
kj
::
str
(
" KJ_IREQUIRE(which() == "
,
scope
,
upperCase
,
",
\n
"
// Extra parens around the condition are needed for when we're compiling a multi-arg
// generic type, which will have a comma, which would otherwise mess up the macro.
// Ah, C++.
" KJ_IREQUIRE((which() == "
,
scope
,
upperCase
,
"),
\n
"
"
\"
Must check which() before get()ing a union member.
\"
);
\n
"
),
"
\"
Must check which() before get()ing a union member.
\"
);
\n
"
),
kj
::
str
(
kj
::
str
(
" _builder.setDataField<"
,
scope
,
"Which>(
\n
"
" _builder.setDataField<"
,
scope
,
"Which>(
\n
"
...
...
c++/src/capnp/test.capnp
View file @
6b9ac4dd
...
@@ -587,6 +587,15 @@ interface TestImplicitMethodParamsInGeneric(V) {
...
@@ -587,6 +587,15 @@ interface TestImplicitMethodParamsInGeneric(V) {
call @0 [T, U] (foo :T, bar :U) -> TestGenerics(T, U);
call @0 [T, U] (foo :T, bar :U) -> TestGenerics(T, U);
}
}
struct TestGenericsUnion(Foo, Bar) {
# At one point this failed to compile.
union {
foo @0 :Foo;
bar @1 :Bar;
}
}
struct TestUseGenerics $TestGenerics(Text, Data).ann("foo") {
struct TestUseGenerics $TestGenerics(Text, Data).ann("foo") {
basic @0 :TestGenerics(TestAllTypes, TestAnyPointer);
basic @0 :TestGenerics(TestAllTypes, TestAnyPointer);
inner @1 :TestGenerics(TestAllTypes, TestAnyPointer).Inner;
inner @1 :TestGenerics(TestAllTypes, TestAnyPointer).Inner;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment