Skip to content

Commit fcbdb6c

Browse files
committed
Make warnings & errors involving initializer list arguments more obvious.
1 parent d9be604 commit fcbdb6c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/liboslcomp/typecheck.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,11 @@ class CandidateFunctions {
16401640
const char *comma = "";
16411641
for (ASTNode::ref arg = m_args; arg; arg = arg->next()) {
16421642
argstr += comma;
1643-
argstr += arg->typespec().string();
1643+
if (arg->typespec().simpletype().is_unknown() &&
1644+
arg->nodetype() == ASTNode::compound_initializer_node) {
1645+
argstr += "initializer-list";
1646+
} else
1647+
argstr += arg->typespec().string();
16441648
comma = ", ";
16451649
}
16461650
argstr += ")";

testsuite/oslc-err-initlist-args/ref/out.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
test.osl:52: error: No matching function call to 'failifnota (unknown)'
1+
test.osl:52: error: No matching function call to 'failifnota (initializer-list)'
22
Candidates are:
33
test.osl:16 void failifnota (struct acolor)
4-
test.osl:53: error: No matching function call to 'failifnota (unknown)'
4+
test.osl:53: error: No matching function call to 'failifnota (initializer-list)'
55
Candidates are:
66
test.osl:16 void failifnota (struct acolor)
7-
test.osl:54: error: Ambiguous call to 'ddd (unknown, int)'
7+
test.osl:54: error: Ambiguous call to 'ddd (initializer-list, int)'
88
Candidates are:
99
test.osl:35 void ddd (struct B, int)
1010
test.osl:34 void ddd (struct A, int)
11-
test.osl:55: error: Ambiguous call to 'eee (unknown, int)'
11+
test.osl:55: error: Ambiguous call to 'eee (initializer-list, int)'
1212
Candidates are:
1313
test.osl:37 float eee (struct A, int)
1414
test.osl:38 void eee (struct B, int)
15-
test.osl:56: error: Ambiguous call to 'noise (unknown)'
15+
test.osl:56: error: Ambiguous call to 'noise (initializer-list)'
1616
Candidates are:
1717
test.osl:46 float noise (struct A)
1818
float noise (point)
1919
color noise (point)
2020
vector noise (point)
21-
test.osl:57: error: Ambiguous call to 'fff (unknown)'
21+
test.osl:57: error: Ambiguous call to 'fff (initializer-list)'
2222
Candidates are:
2323
test.osl:41 void fff (point)
2424
test.osl:40 void fff (struct A)
25-
test.osl:58: error: Ambiguous call to 'ggg (unknown)'
25+
test.osl:58: error: Ambiguous call to 'ggg (initializer-list)'
2626
Candidates are:
2727
test.osl:44 float ggg (struct D)
2828
test.osl:43 void ggg (struct C)

0 commit comments

Comments
 (0)