Ticket #2015: format_bug.cc

File format_bug.cc, 1.1 KB (added by Geoff Barrett <gbarrett@…>, 14 years ago)

program that reproduces the problem

Line 
1/*
2 */
3
4/*
5 * Copyright (c) 2008 Broadcom Corporation
6 *
7 * All rights reserved.
8 *
9 * This source code contains proprietary, confidential and trade secret
10 * information of Broadcom Corp, and except as provided by written agreement
11 * with Broadcom Corp no part may be disclosed, distributed, reproduced,
12 * transmitted, transcribed, stored in a retrieval system, adapted or
13 * translated in any form or by any means electronic, mechanical, magnetic,
14 * optical, chemical, manual or otherwise.
15 */
16
17#include "boost/format.hpp"
18#include <iostream>
19#include <iomanip>
20#include <cassert>
21
22class bcu {
23public:
24enum { BCU_ANON = 0x8000 };
25};
26
27template<class T>
28void
29bar(const T& x) {
30}
31
32template<class T>
33void
34foo1(const T& x) {
35 bar(x);
36}
37
38template<class T>
39void
40foo2(const T& x) {
41 bar<T>(x);
42}
43
44int
45main() {
46 enum mytype_e { ANON = 0x8000 };
47 foo1(0);
48 foo1(bcu::BCU_ANON);
49 // foo2(bcu::BCU_ANON);
50 foo1(ANON);
51 // foo2(ANON);
52 std::cout << boost::format("%32x\n") % bcu::BCU_ANON;
53 std::cout << boost::format("%32x\n") % ANON;
54 std::cout << std::hex << std::showbase << bcu::BCU_ANON << std::endl;
55
56 return 0;
57}