aboutsummaryrefslogtreecommitdiff
path: root/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
blob: d3568caa81a3846d8727055b009dcfb6858a289b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads

// TODO(EricWF) Investigate why typeid(...).name() returns a different string
// on GCC 4.9 but not newer GCCs.
// XFAIL: gcc-4.9

// THIS TESTS C++03 EXTENSIONS.

// <mutex>

// template <class ...Mutex> class lock_guard;

// Test that the the variadic lock guard implementation mangles the same in
// C++11 and C++03. This is important since the mangling of `lock_guard` depends
// on it being declared as a variadic template, even in C++03.

// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <string>
#include <typeinfo>
#include <cassert>

int main() {
    const std::string expect = "NSt3__110lock_guardIJNS_5mutexEEEE";
    assert(typeid(std::lock_guard<std::mutex>).name() == expect);
}