Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/SemaTemplate/instantiate-field.cpp
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

105 lines
2.5 KiB
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X {
int x;
T y; // expected-error{{data member instantiated with function type}}
T* z;
T bitfield : 12; // expected-error{{bit-field 'bitfield' has non-integral type 'float'}} \
// expected-error{{data member instantiated with function type}}
mutable T x2; // expected-error{{data member instantiated with function type}}
};
void test1(const X<int> *xi) {
int i1 = xi->x;
const int &i2 = xi->y;
int* ip1 = xi->z;
int i3 = xi->bitfield;
xi->x2 = 17;
}
void test2(const X<float> *xf) {
(void)xf->x; // expected-note{{in instantiation of template class 'X<float>' requested here}}
}
void test3(const X<int(int)> *xf) {
(void)xf->x; // expected-note{{in instantiation of template class 'X<int (int)>' requested here}}
}
namespace PR7123 {
template <class > struct requirement_;
template <void(*)()> struct instantiate
{ };
template <class > struct requirement ;
struct failed ;
template <class Model> struct requirement<failed *Model::*>
{
static void failed()
{
((Model*)0)->~Model(); // expected-note{{in instantiation of}}
}
};
template <class Model> struct requirement_<void(*)(Model)> : requirement<failed *Model::*>
{ };
template <int> struct Requires_
{ typedef void type; };
template <class Model> struct usage_requirements
{
~usage_requirements()
{((Model*)0)->~Model(); } // expected-note{{in instantiation of}}
};
template < typename TT > struct BidirectionalIterator
{
enum
{ value = 0 };
instantiate< requirement_<void(*)(usage_requirements<BidirectionalIterator>)>::failed> int534; // expected-note{{in instantiation of}}
~BidirectionalIterator()
{ i--; } // expected-error{{cannot decrement value of type 'PR7123::X'}}
TT i;
};
struct X
{ };
template<typename RanIter>
typename Requires_< BidirectionalIterator<RanIter>::value >::type sort(RanIter,RanIter){}
void f()
{
X x;
sort(x,x);
}
}
namespace PR7355 {
template<typename T1> class A {
class D; // expected-note{{declared here}}
D d; //expected-error{{implicit instantiation of undefined member 'PR7355::A<int>::D'}}
};
A<int> ai; // expected-note{{in instantiation of}}
}
namespace PR8712 {
template <int dim>
class B {
public:
B(const unsigned char i);
unsigned char value : (dim > 0 ? dim : 1);
};
template <int dim>
inline B<dim>::B(const unsigned char i) : value(i) {}
}