blob: 41721710649403030af7838f901b888b6147f1d3 (
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
37
38
39
40
41
42
43
44
45
46
|
//===--- templated_constructor.cc - test input file for iwyu --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// IWYU_ARGS: -I .
// Tests that we handle correctly the case of templated constructors.
#include "tests/cxx/direct.h"
struct TemplatedConstructor {
template<typename T> TemplatedConstructor(const T* obj, int dummy) {
a_ = obj->a;
}
int a_;
};
int main() {
// IWYU: IndirectClass needs a declaration
IndirectClass* ic = 0;
// IWYU: IndirectClass is...*indirect.h
TemplatedConstructor tc(ic, 1);
// IWYU: IndirectClass is...*indirect.h
TemplatedConstructor* tcp = new TemplatedConstructor(ic, 1);
}
/**** IWYU_SUMMARY
tests/cxx/templated_constructor.cc should add these lines:
#include "tests/cxx/indirect.h"
tests/cxx/templated_constructor.cc should remove these lines:
- #include "tests/cxx/direct.h" // lines XX-XX
The full include-list for tests/cxx/templated_constructor.cc:
#include "tests/cxx/indirect.h" // for IndirectClass
***** IWYU_SUMMARY */
|