-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add =default/delete declarations + macro making empty canonical destr…
…uctors (body consists only of 'pass') the same as =default
- Loading branch information
Showing
7 changed files
with
129 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
struct (Foo1: | ||
pass | ||
) | ||
|
||
struct (Foo2: | ||
def (destruct:virtual) = default | ||
) | ||
|
||
struct (Foo3: | ||
# this is actually defaulted like Foo2 (use pass; pass for non-defaulted but empty) | ||
def (destruct:virtual: | ||
pass | ||
) | ||
) | ||
|
||
def (main: | ||
static_assert(not std.has_virtual_destructor_v<Foo1>) | ||
static_assert(std.has_virtual_destructor_v<Foo2>) | ||
static_assert(std.has_virtual_destructor_v<Foo3>) | ||
) |
45 changes: 45 additions & 0 deletions
45
tests/regression/default_destructor_builtin_macro.donotedit.autogenerated.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
#include <string> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <functional> | ||
#include <cassert> | ||
#include <compare> // for <=> | ||
#include <thread> | ||
#include <optional> | ||
|
||
|
||
#include "ceto.h" | ||
//#include "ceto_private_boundscheck.donotedit.autogenerated.h" | ||
|
||
#include "ceto_private_listcomp.donotedit.autogenerated.h" | ||
; | ||
#include "ceto_private_boundscheck.donotedit.autogenerated.h" | ||
; | ||
#include "ceto_private_convenience.donotedit.autogenerated.h" | ||
; | ||
struct Foo1 : public ceto::object { | ||
|
||
}; | ||
|
||
struct Foo2 : public ceto::object { | ||
|
||
virtual ~Foo2() = default; | ||
|
||
}; | ||
|
||
struct Foo3 : public ceto::object { | ||
|
||
virtual ~Foo3() = default; | ||
|
||
}; | ||
|
||
auto main() -> int { | ||
static_assert(!std::has_virtual_destructor_v<Foo1>); | ||
static_assert(std::has_virtual_destructor_v<Foo2>); | ||
static_assert(std::has_virtual_destructor_v<Foo3>); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def (foo<T>, x: T: | ||
return x | ||
) | ||
|
||
def (main: | ||
foo(5) | ||
) |
31 changes: 31 additions & 0 deletions
31
tests/regression/template_func_builtin_macro_convenience.donotedit.autogenerated.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
#include <string> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <functional> | ||
#include <cassert> | ||
#include <compare> // for <=> | ||
#include <thread> | ||
#include <optional> | ||
|
||
|
||
#include "ceto.h" | ||
//#include "ceto_private_boundscheck.donotedit.autogenerated.h" | ||
|
||
#include "ceto_private_listcomp.donotedit.autogenerated.h" | ||
; | ||
#include "ceto_private_boundscheck.donotedit.autogenerated.h" | ||
; | ||
#include "ceto_private_convenience.donotedit.autogenerated.h" | ||
; | ||
template<typename T> inline auto foo(const T x) -> auto { | ||
return x; | ||
} | ||
|
||
auto main() -> int { | ||
foo(5); | ||
} | ||
|