Skip to content

No diagnostic for error in instantiated context #137

@HighCommander4

Description

@HighCommander4

Given the following two files:

test.hpp:

void bar(int);

template <typename T> void foo(T t) { bar(t); }

test.cpp:

#include "main.hpp"

struct S {};

int main() { foo(S()); }

I do not get any diagnostics when I open test.cpp, even though it does not compile:

In file included from test.cpp:1:
test.hpp:3:39: error: no matching function for call to 'bar'
template <typename T> void foo(T t) { bar(t); }
                                      ^~~
test.cpp:5:14: note: in instantiation of function template specialization 'foo<S>' requested here
int main() { foo(S()); }
             ^
test.hpp:1:6: note: candidate function not viable: no known conversion from 'S' to 'int' for 1st argument
void bar(int);
     ^
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions