xref: /aosp_15_r20/external/clang/test/CXX/over/over.built/p23.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2*67e74705SXin Li // expected-no-diagnostics
3*67e74705SXin Li 
4*67e74705SXin Li struct Variant {
5*67e74705SXin Li   template <typename T> operator T();
6*67e74705SXin Li };
7*67e74705SXin Li 
8*67e74705SXin Li Variant getValue();
9*67e74705SXin Li 
testVariant()10*67e74705SXin Li void testVariant() {
11*67e74705SXin Li   bool ret1 = getValue() || getValue();
12*67e74705SXin Li   bool ret2 = getValue() && getValue();
13*67e74705SXin Li   bool ret3 = !getValue();
14*67e74705SXin Li }
15*67e74705SXin Li 
16*67e74705SXin Li struct ExplicitVariant {
17*67e74705SXin Li   template <typename T> explicit operator T();
18*67e74705SXin Li };
19*67e74705SXin Li 
20*67e74705SXin Li ExplicitVariant getExplicitValue();
21*67e74705SXin Li 
testExplicitVariant()22*67e74705SXin Li void testExplicitVariant() {
23*67e74705SXin Li   bool ret1 = getExplicitValue() || getExplicitValue();
24*67e74705SXin Li   bool ret2 = getExplicitValue() && getExplicitValue();
25*67e74705SXin Li   bool ret3 = !getExplicitValue();
26*67e74705SXin Li }
27