From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../temp/temp.fct.spec/temp.deduct/sfinae-1.cpp | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 clang/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp (limited to 'clang/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp') diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp new file mode 100644 index 0000000..6481485 --- /dev/null +++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -verify %s + +typedef char one_byte; +struct two_bytes { char data[2]; }; + +template one_byte __is_class_check(int T::*); +template two_bytes __is_class_check(...); + +template struct is_class { + static const bool value = sizeof(__is_class_check(0)) == 1; +}; + +struct X { }; + +int array0[is_class::value? 1 : -1]; +int array1[is_class::value? -1 : 1]; +int array2[is_class::value? -1 : 1]; + +namespace instantiation_order1 { + template + struct it_is_a_trap { + typedef typename T::trap type; + }; + + template + struct enable_if { + typedef T type; + }; + + template + struct enable_if { }; + + template + typename enable_if::type + f(const T&, typename it_is_a_trap::type* = 0); + + void f(...); + + void test_f() { + f('a'); + } +} -- cgit v1.2.3