Skip to content

Commit ad6ff57

Browse files
committed
[FOLD] add test
1 parent 2721a31 commit ad6ff57

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

clang/test/SemaCXX/decltype.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,31 @@ namespace GH97646 {
147147
}
148148
}
149149

150+
namespace GH99873 {
151+
struct B {
152+
int x;
153+
};
154+
155+
template<typename T>
156+
struct A {
157+
template<typename U>
158+
constexpr int f() const {
159+
return 1;
160+
}
161+
162+
template<>
163+
constexpr int f<int>() const {
164+
return decltype(B::x)();
165+
}
166+
};
167+
168+
// This shouldn't crash.
169+
static_assert(A<int>().f<int>() == 0, "");
170+
// The result should not be dependent.
171+
static_assert(A<int>().f<int>() != 0, ""); // expected-error {{static assertion failed due to requirement 'GH99873::A<int>().f<int>() != 0'}}
172+
// expected-note@-1 {{expression evaluates to '0 != 0'}}
173+
}
174+
150175
template<typename>
151176
class conditional {
152177
};

0 commit comments

Comments
 (0)